From 65971a5ab5d114e4cccee0c75128127a8d2fa32d Mon Sep 17 00:00:00 2001 From: Dane Madsen Date: Sun, 30 Jul 2023 19:58:37 +1000 Subject: [PATCH] Upload Files --- softwrap2/__init__.py | 1208 + softwrap2/core/core2.cpp | 37453 +++++++++++++++++ softwrap2/core/core2.pyx | 1559 + softwrap2/draw_3d.py | 239 + softwrap2/setup.py | 111 + softwrap2/softwrap_core2.cp310-win_amd64.pyd | Bin 0 -> 195584 bytes 6 files changed, 40570 insertions(+) create mode 100644 softwrap2/__init__.py create mode 100644 softwrap2/core/core2.cpp create mode 100644 softwrap2/core/core2.pyx create mode 100644 softwrap2/draw_3d.py create mode 100644 softwrap2/setup.py create mode 100644 softwrap2/softwrap_core2.cp310-win_amd64.pyd diff --git a/softwrap2/__init__.py b/softwrap2/__init__.py new file mode 100644 index 0000000..b8fb790 --- /dev/null +++ b/softwrap2/__init__.py @@ -0,0 +1,1208 @@ +# Copyright (C) 2021 Jean Da Costa machado. +# Jean3dimensional@gmail.com +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import bpy +import bmesh +import gc +import random +import time +from math import atan2, ceil +from . import softwrap_core2 as core +from . draw_3d import DrawCallback +from bpy_extras.view3d_utils import region_2d_to_origin_3d, region_2d_to_vector_3d, location_3d_to_region_2d +from mathutils.geometry import intersect_line_plane +from mathutils import Vector, Matrix +from collections import namedtuple, defaultdict +import bpy.app.handlers as handlers + + +bl_info = {'name': 'Softwrap 2', + 'description': 'Transfer topology from one model to another using a softbody simulation', + 'author': 'Jean Da Costa Machado', + 'version': ('2.1.2-alpha-for-blender3.1 -- a928357391',), # ship:-v + 'blender': (3, 1, 0), + 'doc_url': 'https://jeacom25b.github.io/Softwrap-Manual/', + 'tracker_url': 'https://jeacom25b.github.io/Softwrap-Manual/', + 'category': 'Mesh', + 'location': '3D view > properties (N-panel) > Softwrap 2'} + +all_classes = [] + +running_op = None + +SW_SHAPE_KEY_NAME = 'SoftWrap_Shape_key' + + +def register_cls(cls): + all_classes.append(cls) + return cls + + +class PerfTimer: + timer_data = defaultdict(list) + timer_tmp = {} + + def start(self, key='time'): + self.timer_tmp[key] = time.time() + + def stop(self, key='time', max_samples=30): + self.timer_data[key].append(time.time() - self.timer_tmp[key]) + + def __str__(self): + return '' + + +def register_panel_draw(label=None, parent_cls=None, poll=lambda s, c: True): + def decorator(draw_fnc): + nonlocal label, parent_cls, poll + if not label or callable(label): + label = ' '.join(x.capitalize() for x in draw_fnc.__name__.split('_')) + namespace = { + 'bl_label': label, + 'bl_space_type': 'VIEW_3D', + 'bl_region_type': 'UI', + 'bl_category': 'Softwrap 2', + 'poll': classmethod(poll), + 'draw': draw_fnc + } + if parent_cls: + namespace['bl_parent_id'] = parent_cls.__name__ + + return register_cls(type(f'VIEW3D_PT_softwrap2_{draw_fnc.__name__}', + (bpy.types.Panel,), + namespace)) + if callable(label): # actually draw_fnc + return decorator(label) + return decorator + + +def smoothstep(f, fmin=0, fmax=1): + f = max(0, min(1, (f - fmin) / (fmax - fmin))) + return f * f * (3 - 2 * f) + + +def lerp(a, b, f): + return (b - a) * f + a + + +def intersect_point_2d_rectangle(px, py, rx, ry, width, height): + if px <= rx: + return False + if py <= ry: + return False + if px - rx >= width: + return False + if py - ry >= height: + return False + + return True + + +def areas_under_mouse(context, event): + mx, my = event.mouse_x, event.mouse_y + areas = [] + for area in context.screen.areas: + regions = [] + + if intersect_point_2d_rectangle(mx, my, area.x, area.y, area.width, area.height): + for region in area.regions: + if intersect_point_2d_rectangle(mx, my, region.x, region.y, region.width, region.height): + regions.append(region) + + areas.append((area, regions)) + + return areas + + +def get_mouse_ray(context, event, mat=Matrix.Identity(4)): + region = context.region + r3d = context.space_data.region_3d + co = event.mouse_region_x, event.mouse_region_y + origin = mat @ region_2d_to_origin_3d(region, r3d, co) + vec = region_2d_to_vector_3d(region, r3d, co) + vec.rotate(mat) + return origin, vec + + +def mouse_raycast(obj, context, event): + mat = obj.matrix_world.inverted() + origin, vec = get_mouse_ray(context, event, mat) + return obj.ray_cast(origin, vec) + + +def global_to_screen(co, context): + region = context.region + r3d = context.space_data.region_3d + return location_3d_to_region_2d(region, r3d, co) + + +def vertex_group_to_list(obj, vg_name): + vg = obj.vertex_groups.get(vg_name, None) + if not vg: + return None + data = [] + for i in range(len(obj.data.vertices)): + try: + data.append(vg.weight(i)) + except RuntimeError: + data.append(0) + return data + + +def core_mesh_from_bm(bm): + bm.verts.ensure_lookup_table() + verts = [tuple(v.co) for v in bm.verts] + + def triangles(face): + for i in range(len(face.verts) - 2): + yield face.verts[0].index, face.verts[i + 1].index, face.verts[i + 2].index + + faces = [tri for f in bm.faces for tri in triangles(f)] + return core.Mesh(verts, faces) + + +def deduplicate_links(items): + if not items: + return items + return list(tuple(x) for x in set(frozenset(a) for a in items) if len(x) == 2) + + +def loop_pairs(elems): + n = len(elems) + half_n = n // 2 + + for i in range(half_n + n % 2): + yield (elems[i], elems[(i + half_n) % n]) + + +def sort_vert_link_edges(vert): + u = vert.normal.orthogonal().normalized() + v = vert.normal.cross(u) + o = vert.co + + def angle(edge): + vec = vert.co - edge.other_vert(vert).co + return atan2(vec.dot(u), vec.dot(v)) + + return sorted(vert.link_edges, key=angle) + + +def sort_vert_link_loops(vert): + u = vert.normal.orthogonal().normalized() + v = vert.normal.cross(u) + o = vert.co + + loops = vert.link_loops + + def angle(loop): + vec = loop.vert.co - loop.link_loop_next.vert.co + return atan2(vec.dot(u), vec.dot(v)) + + return sorted(loops, key=angle) + + +def structural_springs_indexes(bm): + springs = list(tuple(v.index for v in edge.verts) for edge in bm.edges) + return springs + + +def somoothing_springs_indexes(bm): + return [tuple(v.index for v in edge.verts) for edge in bm.edges if edge.verts[0].is_boundary == edge.verts[1].is_boundary] + + +def shear_spring_indexes(bm): + return [(v.index for v in pair) for face in bm.faces for pair in loop_pairs(face.verts)] + + +def bending_spring_indexes(bm, distance=1): + distance = max(distance, 1) + + springs = {} + length_correlations = set() + links_by_edge = defaultdict(list) + + for vert in bm.verts: + for loop in vert.link_loops: + edge = loop.edge + links_by_edge[edge].append([]) + for _ in range(distance): + loop = loop.link_loop_next + for _ in range(len(loop.vert.link_edges) // 2 - 1): + loop = loop.link_loop_radial_next.link_loop_next + + other = loop.vert + if vert.index == other.index: + continue + + spr = frozenset((vert.index, other.index)) + if spr not in springs: + springs[spr] = 1 + links_by_edge[edge][-1].append(len(springs) - 1) + + for edge in bm.edges: + for spring_chain in links_by_edge[edge]: + for i in range(len(spring_chain) - 1): + length_correlations.add(frozenset((spring_chain[i], spring_chain[i + 1]))) + + return list(springs.keys()) # , list(length_correlations) + + +def ternary_links_indexes(bm): + links = [] + for vert in bm.verts: + for ea, eb in loop_pairs(sort_vert_link_edges(vert)): + va = ea.other_vert(vert) + vb = eb.other_vert(vert) + link = vert.index, va.index, vb.index + if not len(frozenset(link)) < 3: + links.append(link) + return links + + +def quaternary_link_indexes(bm): + links = [] + for face in bm.faces: + if len(face.verts) == 4: + indexes = *(v.index for v in face.verts), + links.append((indexes[0], indexes[1], indexes[3], indexes[2])) + links.append((indexes[0], indexes[3], indexes[1], indexes[2])) + links.append((indexes[0], indexes[2], indexes[1], indexes[3])) + + for vert in bm.verts: + for e1, e2 in loop_pairs(sort_vert_link_edges(vert)): + if e1.is_manifold and e2.is_manifold: + links.append((vert.index, e1.other_vert(vert).index, vert.index, e2.other_vert(vert).index)) + + return links + + +def iter_float_factor(value, max_val, power_fac=1, size=1): + value = (value / size) ** power_fac * size + i = 0 + while value > 0: + yield i, min(value, max_val) + value -= max_val + i += 1 + + +@register_cls +class SoftwrapSettings(bpy.types.PropertyGroup): + def stop_engine(self, context): + if running_op: + running_op.stop(context) + + def set_wire(self, context): + if self.source_ob: + self.wire = self.source_ob.show_wire + + def source_ob_update(self, context): + if self.source_ob and not self.source_ob.type == 'MESH': + self.source_ob = None + self.stop_engine(context) + self.set_wire(context) + + def target_ob_update(self, context): + if self.target_ob and not self.target_ob.type == 'MESH': + self.target_ob = None + self.stop_engine(context) + + def wire_update(self, context): + if self.source_ob: + self.source_ob.show_wire = self.wire + self.source_ob.show_all_edges = self.wire + + def snapping_group_update(self, context): + if running_op: + running_op.snapping_mask_update(context) + + def simulation_group_update(self, context): + if running_op: + running_op.simulation_mask_update(context) + + def mesh_poll(self, ob): + return ob.type == 'MESH' and ob.name in bpy.context.scene.objects + + source_ob: bpy.props.PointerProperty( + name='source mesh', type=bpy.types.Object, update=source_ob_update, poll=mesh_poll, + description='The mesh that is going to be deformed into a new shape using the target mesh as reference') + + target_ob: bpy.props.PointerProperty( + name='target mesh', type=bpy.types.Object, update=target_ob_update, poll=mesh_poll, + description='The mesh that is going to be used as reference, (tipcally a sculpt or a 3d scan)') + + snapping_group: bpy.props.StringProperty( + name='Snapping Group', update=snapping_group_update, + description='vertex group to mask what vertices are involved on the snapping') + + snapping_group_invert: bpy.props.BoolProperty( + name='Invert Snapping Group', + description='Inverts the vertex group influence',) + + simulation_group: bpy.props.StringProperty( + name='Simulation Group', update=simulation_group_update, + description='vertex group to mask what vertices should be simulated,') + + simulation_group_invert: bpy.props.BoolProperty( + name='Invert Simulation Group', + description='Inverts the vertex group influence',) + + wire: bpy.props.BoolProperty( + name='Wire', update=wire_update, + description='Toggle wireframe display on the source mesh') + + mirror: bpy.props.BoolVectorProperty( + name='Mirror', size=3, default=(False, False, False), + description='Enforce symmetry acrons an axis.') + + min_scaling: bpy.props.FloatProperty( + name='Min Scaling', default=0.3, + description='Minimun allowed rest length for edges') + + max_scaling: bpy.props.FloatProperty( + name='Max Scaling', default=3, + description='Maximun allowed rest length for edges') + + scale_plasticity: bpy.props.FloatProperty( + name='Scale Plasticity', min=0, max=1, default=0.1, + description='Amount of semi-permanent deformation per frame') + + scale_restoration: bpy.props.FloatProperty( + name='Scale Restoration', min=0, max=1, default=0.05, + description='Amount of restoration to the semi-parmanent deformation per frame') + + smooth: bpy.props.FloatProperty( + name='Smooth', min=0, soft_max=5, default=0, + description='Amount of somothing applied to the mesh per frame (nonlinear)\n' + 'Note: has the side effect of swrinking the mesh,') + + quad_smoothing: bpy.props.FloatProperty( + name='Quad Smooth', min=0, soft_max=10, default=0, + description='Amount of force applied per frame to restore the shape of quads (nonlinear)\n' + 'Note: has the side effect of swrinking the mesh,') + + topologic_smooth: bpy.props.FloatProperty( + name='Topologic Smooth', min=0, soft_max=5, default=2, + description='Amount of topology-aware smoothing applied to the mesh per frame, (nonlinear)\n' + 'Note: Less aggressive than smooth, ideal for removing kinks in edge loops caused by by pins') + + structural_stiffness: bpy.props.FloatProperty( + name='Structural Stiffness', min=0, soft_max=10, default=2, + description='Stiffness of the direct links between vertices') + + bending_stiffness: bpy.props.FloatProperty( + name='Bending Stiffness', min=0, soft_max=10, default=2, + description='Stiffness of the links across multiple edges') + + shear_stiffness: bpy.props.FloatProperty( + name='Shear Stiffness', min=0, soft_max=10, default=2, + description='Stiffness of the links across face diagonals') + + bending_distance: bpy.props.IntProperty( + name='Bending Distance', min=0, default=3, + description='Maximun distance (by edges) for bending springs to be created') + + damping: bpy.props.FloatProperty( + name='Damping', min=0, max=1, default=0.25, + description='Dampen the simulation to increase stability') + + simulation_steps: bpy.props.IntProperty( + name='Simulation Steps', min=0, default=2, + description='Number of simulation steps per frame') + + snapping_quality: bpy.props.IntProperty( + name='Snapping Quality', min=1, max=20, default=10, + description='How of often to update the snapping direction from the source mesh to the target mesh') + + snapping_force: bpy.props.FloatProperty( + name='Snapping Strength', min=0, max=1, default=0, + description='Strength of the snapping, how much it pulls the source mesh towards the target mesh') + + snapping_mode: bpy.props.EnumProperty( + name='Snap Mode', default='SURFACE', + items = [('SURFACE', 'Surface', 'Surface'), + ('OUTSIDE', 'Outside', 'Outside'), + ('INSIDE', 'Inside', 'Inside')], + description='Controls which side of the target mesh affects the snapping.') + + project_pins: bpy.props.BoolProperty( + name='Project Pins', default=True, + description='Virtually snap pins to the surface of the target mesh based on snapping force.\n') + + pin_force: bpy.props.FloatProperty( + name='Pin Force', min=0, max=1, default=1, + description='How strongly pins pull on the mesh') + + mouse_grab_size: bpy.props.IntProperty( + name='Mouse Grab Size', min=1, default=3, + description='Size of the area grabbed by the mouse') + + pause: bpy.props.BoolProperty( + name='Pause (Space)', default=False, + description='Temporarily halt the simulation') + + interact_mouse: bpy.props.BoolProperty( + name='Interaction (Shift + Space)', default=True, + description='Enable interception of mouse events for pin creation and grabbing') + + mouse_button: bpy.props.EnumProperty( + name='Interact With', default='LEFTMOUSE', + items=[('LEFTMOUSE', 'Left Mouse', 'Left Mouse'), ('RIGHTMOUSE', 'Right Mouse', 'Right Mouse')], + description='Which mouse button to use for interacting with the simulation ') + + +def get_settings(context): + return bpy.context.scene.softwrap2 + + +S = type('SettingsProbe', (), { + '__getattr__': lambda s, k: getattr(get_settings(bpy.context), k), + '__setattr__': lambda s, k, v: setattr(get_settings(bpy.context), k, v), + '__call__': lambda s: get_settings(bpy.context) +})() + + +@register_panel_draw +def softwrap_2(self, context): + pass + + +@register_panel_draw(parent_cls=softwrap_2) +def interaction(self, context): + layout = self.layout + if running_op: + if S.interact_mouse: + mouse_side = S.mouse_button.replace('_', ' ').lower() + layout.label(text=f'[shift + {mouse_side}] to add a pin') + else: + layout.label(text=f'Mouse interaction disabled') + + col = layout.column(align=True) + col.prop(S(), 'interact_mouse', toggle=True) + col.prop(S(), 'pause', toggle=True) + row = col.row(align=True) + row.prop(S(), 'mouse_button', expand=True) + col.separator() + + layout.prop(S(), 'mouse_grab_size') + + +@register_panel_draw(parent_cls=softwrap_2) +def initialization(self, context): + layout = self.layout + col = layout.column(align=True) + row = col.row(align=True) + row.scale_y = 2 + if running_op: + running_anim = ['*---', '-*--', + '--*-', '---*', + '--*-', '-*--'][int(time.time() * 5) % 5] + row.operator('object.start_softwrap', text=f'Stop {running_anim}', icon='CANCEL') + row.prop(S(), 'pause', icon='PAUSE') + else: + row.operator('object.start_softwrap', text='Start', icon='PLAY') + + row = col.row(align=True) + row.operator('object.apply_softwrap') + row.operator('object.reset_softwrap') + row.operator('object.pins_remove_softwrap') + + if S.source_ob: + layout.label(text='Display') + row = layout.row(align=True) + row.prop(S(), 'wire', toggle=True) + row.prop(S().source_ob, 'show_in_front', toggle=True) + layout.separator() + + col = layout.column(align=True) + col.label(text='Source Mesh:') + col.prop(S(), 'source_ob', text='') + col.separator() + + col.label(text='Target Mesh:') + col.prop(S(), 'target_ob', text='') + layout.separator() + + col = layout.column() + col.active = not running_op + col.prop(S(), 'bending_distance') + + +@register_panel_draw(parent_cls=softwrap_2) +def dynamics(self, context): + pass + + +@register_panel_draw(parent_cls=dynamics) +def symmetry(self, context): + layout = self.layout + row = layout.row(align=True) + row.label(text='Mirror') + for i, axis in enumerate('XYZ'): + row.prop(S(), 'mirror', text=axis, index=i, toggle=True) + + if running_op: + for axis, enable, error, scale, dim in zip('XYZ', S.mirror, running_op.symmetry_map.error, S.source_ob.scale, S.source_ob.dimensions): + if enable and error / (dim / scale) > 0.05: + layout.label(text=f'Warning: source mesh may not be symmetrical at axis {axis}', icon='ERROR') + layout.label(text=f' Error: {round(error / (dim / scale) , 6)}') + + +@register_panel_draw(parent_cls=dynamics) +def Stiffness(self, context): + layout = self.layout + col = layout.column(align=True) + col.prop(S(), 'structural_stiffness', slider=True) + col.prop(S(), 'shear_stiffness', slider=True) + col.prop(S(), 'bending_stiffness', slider=True) + layout.prop(S(), 'damping', slider=True) + + +@register_panel_draw(parent_cls=dynamics) +def smoothing(self, context): + layout = self.layout + layout.prop(S(), 'smooth', slider=True) + layout.prop(S(), 'quad_smoothing', slider=True) + layout.prop(S(), 'topologic_smooth', slider=True) + layout.separator() + + +@register_panel_draw(parent_cls=dynamics) +def snapping(self, context): + layout = self.layout + layout.prop(S(), 'snapping_force', slider=True) + layout.prop(S(), 'snapping_mode') + + layout.separator() + + if S.source_ob: + layout.label(text='Snapping Group') + row = layout.row(align=True) + row.prop_search(S(), 'snapping_group', S.source_ob, 'vertex_groups', text='') + row.prop(S(), 'snapping_group_invert', text='', icon='ARROW_LEFTRIGHT') + + layout.label(text='Simulation Group') + row = layout.row(align=True) + row.prop_search(S(), 'simulation_group', S.source_ob, 'vertex_groups', text='') + row.prop(S(), 'simulation_group_invert', text='', icon='ARROW_LEFTRIGHT') + + layout.label(text='Pins:') + layout.prop(S(), 'project_pins') + layout.prop(S(), 'pin_force', slider=True) + + +@register_panel_draw(parent_cls=dynamics) +def plasticity(self, context): + layout = self.layout + row = layout.row(align=True) + row.prop(S(), 'min_scaling') + row.prop(S(), 'max_scaling') + + row = layout.row(align=True) + row.prop(S(), 'scale_plasticity') + row.prop(S(), 'scale_restoration') + + +@register_panel_draw(parent_cls=softwrap_2) +def performance(self, context): + layout = self.layout + layout.prop(S(), 'simulation_steps') + layout.prop(S(), 'snapping_quality', slider=True) + + +PinCacheData = namedtuple('PinCacheData', 'engine_pin type scale factor world_pos', defaults=(None,) * 5) + + +@register_cls +class OBJECT_OT_start_softwrap(bpy.types.Operator): + bl_idname = 'object.start_softwrap' + bl_label = 'Test springs' + bl_options = {'REGISTER', 'UNDO'} + bl_description = 'Run the softwrap softbody engine' + + _timer = None + + source_mesh = None + target_mesh = None + + bvh = None + engine = None + structural_springs = None + shear_springs = None + bending_springs = None + + symmetry_map = None + + mouse_pin_pos = None + mouse_pin_delta = None + mouse_pin = None + + pin_cache = None + + simulation_mask = None + snapping_mask = None + + draw3d = None + + last_mode = None + + perf_timer = None + + @classmethod + def poll(self, context): + + if S.target_ob and not S.target_ob.type == 'MESH': + return False + return S.source_ob and S.source_ob.type == 'MESH' + + def invoke(self, context, event): + + global running_op + if running_op: + running_op.stop(context) + return {'CANCELLED'} + + S.source_ob.data.update() + bm = bmesh.new() + bm.from_mesh(S.source_ob.data) + + self.source_mesh = core_mesh_from_bm(bm) + + if S.target_ob: + tbm = bmesh.new() + tbm.from_mesh(S.target_ob.data) + bmesh.ops.transform(tbm, matrix=S.target_ob.matrix_world, space=Matrix.Identity(4), verts=tbm.verts) + bmesh.ops.transform(tbm, matrix=S.source_ob.matrix_world.inverted(), space=Matrix.Identity(4), verts=tbm.verts) + self.target_mesh = core_mesh_from_bm(tbm) + self.bvh = core.BVH(self.target_mesh) + + self.engine = core.SpringEngine(self.source_mesh, self.bvh) + + # import pdb + # pdb.set_trace() + self.structural_springs = self.engine.create_spring_group(structural_springs_indexes(bm)) + self.shear_springs = self.engine.create_spring_group(shear_spring_indexes(bm)) + self.bending_springs = self.engine.create_spring_group(bending_spring_indexes(bm, S.bending_distance)) + + self.symmetry_map = self.engine.create_symmetry_map() + + self.ternary_links = self.engine.create_ternary_links(ternary_links_indexes(bm)) + self.ternary_links.displacements_update() + + self.quaternary_links = self.engine.create_quaternary_links(quaternary_link_indexes(bm)) + self.quaternary_links.lengths_update() + + running_op = self + + self.snapping_mask_update(context) + self.simulation_mask_update(context) + + self.pin_cache = {} + self.draw3d = DrawCallback() + self.draw3d.point_size = 8 + self.draw3d.line_width = 3 + self.draw3d.setup_handler() + + context.window_manager.modal_handler_add(self) + self._timer = context.window_manager.event_timer_add(1 / 60, window=context.window) + self.perf_timer = PerfTimer() # completelly unrelated to self._timer + return {'RUNNING_MODAL'} + + def mouse_pin_set(self, context, event, create_empty=False): + + closest_distance = float('inf') + closest_empty = None + for pin_obj in S.source_ob.get('sw_pins', []): + pin_2d = global_to_screen(pin_obj.location, context) + if not pin_2d: + continue # behind camera + mouse_2d = Vector((event.mouse_region_x, event.mouse_region_y)) + dist = (pin_2d - mouse_2d).length + if dist < closest_distance: + closest_empty = pin_obj + closest_distance = dist + + if closest_empty and closest_distance < 30: + bpy.ops.object.select_all(action='DESELECT') + closest_empty.select_set(True) + context.view_layer.objects.active = closest_empty + return True + + result, location, normal, index = mouse_raycast(S.source_ob, context, event) + + if not result: + return False + + if not S.source_ob.modifiers: + index = min(S.source_ob.data.polygons[index].vertices, + key=lambda i: (self.get_shape(context).data[i].co - location).length) + + else: + index, v_location = self.source_mesh.closest_vert(location) + + if not create_empty: + self.mouse_pin_pos = S.source_ob.matrix_world @ location + self.mouse_pin_delta = self.mouse_pin_pos - S.source_ob.matrix_world @ self.get_shape(context).data[index].co + self.mouse_pin = core.SpringEnginePin(self.structural_springs, index, S.mouse_grab_size) + + else: + empty = bpy.data.objects.new(S.source_ob.name + '_pin', None) + + empty.empty_display_type = 'SPHERE' + radius_disp = self.structural_springs[index].avg_radius + empty.empty_display_size = radius_disp * 2 * sum(S.source_ob.scale) / 3 + empty.show_in_front = True + + empty.location = S.source_ob.matrix_world @ self.get_shape(context).data[index].co + + empty['vert_idx'] = index + bpy.context.collection.objects.link(empty) + pins = list(S.source_ob.get('sw_pins', [])) + pins.append(empty) + S.source_ob['sw_pins'] = pins + bpy.ops.object.select_all(action='DESELECT') + empty.select_set(True) + bpy.context.view_layer.objects.active = empty + bpy.ops.ed.undo_push(message='Add Pin') + + return True + + def mouse_pin_update(self, context, event): + o, dir = get_mouse_ray(context, event) + plane = context.space_data.region_3d.view_rotation @ Vector((0, 0, 1)) + self.mouse_pin_pos = intersect_line_plane(o, o + dir, self.mouse_pin_pos, plane) + + def mouse_pin_clear(self, context, event): + self.mouse_pin_pos = None + self.mouse_pin = None + self.mouse_pin_delta = None + + def empty_pin_scale(self, empty): + return max((sum(empty.scale) / 3) * 4, 1.000001) + + def pin_cache_update(self, context, event): + mat = S.source_ob.matrix_world + mat_inv = S.source_ob.matrix_world.inverted() + + S.source_ob['sw_pins'] = [ + empty for empty in S.source_ob.get('sw_pins', ()) + if empty and empty.name in context.scene.objects + ] + + new_cache = {} + seen_vert_idxs = set() + + def new_pin_reuse_cache(index, pin_type, scale, factor, location, n_rings): + previous_cache = self.pin_cache.get(index, PinCacheData(None)) + previous_pin = previous_cache.engine_pin + + if previous_pin and previous_pin.n_rings == n_rings: + new_cache[index] = PinCacheData(engine_pin=previous_pin, + type=pin_type, + scale=scale, + factor=factor, + world_pos=location) + else: + pin = core.SpringEnginePin(self.structural_springs, index, n_rings) + new_cache[index] = PinCacheData(engine_pin=pin, + type=pin_type, + scale=scale, + factor=factor, + world_pos=location) + + for empty in S.source_ob.get('sw_pins', ()): + index = empty['vert_idx'] + + if empty == context.active_object and empty.select_get(view_layer=context.view_layer): + pin_type = 'ACTIVE_PIN' + else: + pin_type = 'OBJ_PIN' + + vec = mat_inv @ empty.location + vec -= Vector(self.engine.get_verts([index])[0]) + + scale = self.empty_pin_scale(empty) + n_rings = int(scale) + + new_pin_reuse_cache(index, pin_type, scale, 1, empty.location, n_rings) + + if self.mouse_pin_pos: + self.mouse_pin_update(context, event) + pin_type = 'MOUSE_PIN' + index = self.mouse_pin.start_index + new_cache[index] = PinCacheData(engine_pin=self.mouse_pin, + type=pin_type, + scale=self.mouse_pin.n_rings + 1, + factor=1, + world_pos=self.mouse_pin_pos - self.mouse_pin_delta) + + for axis in range(3): + if S.mirror[axis]: + for idx, pin_data in list(new_cache.items()): + mirr_idx = self.symmetry_map[idx][axis] + if mirr_idx == idx: + continue + location = mat_inv @ pin_data.world_pos + location[axis] *= -1 + location = mat @ location + pin_type = 'MIRROR_' + pin_data.type + + new_pin_reuse_cache(mirr_idx, + pin_type, + pin_data.scale, + pin_data.factor, + location, + pin_data.engine_pin.n_rings) + + self.pin_cache = new_cache + + def pin_cache_apply(self, context, event, factor=1, mouse_factor=1): + + mat_inv = S.source_ob.matrix_world.inverted() + + for index, pin_data in self.pin_cache.items(): + vert_loc = Vector(self.engine.get_verts([index])[0]) + local_pos = mat_inv @ pin_data.world_pos + if self.bvh and S.project_pins and S.snapping_force > 0 and not pin_data.type == 'MOUSE_PIN': + f = S.snapping_force + if self.snapping_mask: + f *= 1 - self.snapping_mask[index] + local_pos = lerp(local_pos, Vector(self.bvh.find_nearest(local_pos)[0]), f) + vec = local_pos - vert_loc + if pin_data.type == 'MOUSE_PIN': + f = mouse_factor + else: + f = factor + pin_data.engine_pin.move(*(vec * pin_data.factor * f), pin_data.scale) + + def draw_pins(self, context, event): + + red = Vector((1, 0, 0, 0.5)) + green = Vector((0, 0.9, 0, 0.5)) + blue = Vector((0, 0, 0.5, 0.5)) + cyan = Vector((0, 0.2, 0.8, 0.5)) + purple = (cyan + red) / 2 + + self.draw3d.clear_data() + + for index, pin_data in self.pin_cache.items(): + + vert_loc = S.source_ob.matrix_world @ Vector(self.engine.get_verts([index])[0]) + + if pin_data.type.startswith('MIRROR_'): + self.draw3d.add_line(vert_loc, pin_data.world_pos, purple, cyan) + self.draw3d.add_point(vert_loc, purple) + self.draw3d.add_point(pin_data.world_pos, cyan) + else: + self.draw3d.add_line(vert_loc, pin_data.world_pos, purple, red) + self.draw3d.add_point(vert_loc, purple) + self.draw3d.add_point(pin_data.world_pos, red) + + if pin_data.type in {'ACTIVE_PIN', 'MOUSE_PIN'}: + + for i, ring in enumerate(pin_data.engine_pin): + indexes = list(ring) + locations = self.engine.get_verts(indexes) + f = 1 - max((pin_data.scale - i - 1) / (pin_data.scale - 1), 0) + color = lerp(red, green, smoothstep(f, 0, 0.7) ** 3) + color = lerp(color, blue, smoothstep(f, 0.7, 1)) + color.w = (1 - f) ** 0.2 + for loc in locations: + loc = S.source_ob.matrix_world @ Vector(loc) + self.draw3d.add_point(loc, color) + + self.draw3d.update_batch() + + def snapping_mask_update(self, context): + vg_data = vertex_group_to_list(S.source_ob, S.snapping_group) + self.snapping_mask = self.engine.create_mask(vg_data) + + def simulation_mask_update(self, context): + vg_data = vertex_group_to_list(S.source_ob, S.simulation_group) + self.simulation_mask = self.engine.create_mask(vg_data) + + def reset_simulation(self, context): + vdata = [0] * len(self.engine) + S.source_ob.data.vertices.foreach_get('co', vdata) + self.engine.from_list(vdata) + self.engine.kinetic_step(0) + self.structural_springs.lengths_update() + self.shear_springs.lengths_update() + self.bending_springs.lengths_update() + self.ternary_links.displacements_update() + self.quaternary_links.lengths_update() + + def load_shape_to_engine(self, context): + vdata = [0] * len(self.engine) + self.get_shape(context).data.foreach_get('co', vdata) + self.engine.from_list(vdata) + self.engine.kinetic_step(0) + + def get_shape(self, context): + sk = S.source_ob.data.shape_keys + if sk and SW_SHAPE_KEY_NAME in sk.key_blocks: + return sk.key_blocks[SW_SHAPE_KEY_NAME] + else: + if not sk or len(sk.key_blocks) == 0: + S.source_ob.shape_key_add(name='Basis') + shape = S.source_ob.shape_key_add(name=SW_SHAPE_KEY_NAME) + shape.value = 1 + return shape + + error = None + + def modal(self, context, event): + global running_op + if self.error: + print('operator runned twice') + return {'FINISHED'} + + try: + return self.modal_impl(context, event) + except Exception as e: + self.error = e + self.stop(context) + raise e + + def stop(self, context): + self.draw3d.remove_handler() + bpy.context.window_manager.event_timer_remove(self._timer) + global running_op + running_op = None + + def modal_impl(self, context, event): + global running_op + + if not running_op or event.type == 'ESC'\ + or not S.source_ob\ + or not len(S.source_ob.data.vertices) * 3 == len(self.engine): + + self.stop(context) + return {'FINISHED'} + + if not S.source_ob.mode == 'OBJECT': + self.get_shape(context).mute = True + else: + self.get_shape(context).mute = False + + if not self.last_mode == 'OBJECT' and S.source_ob.mode == 'OBJECT': + self.reset_simulation(context) + self.load_shape_to_engine(context) + self.simulation_mask_update(context) + self.snapping_mask_update(context) + + self.last_mode = S.source_ob.mode + + if event.type == 'SPACE' and event.value == 'PRESS' and not event.ctrl and S.source_ob.mode == 'OBJECT': + if event.shift: + S.interact_mouse = not S.interact_mouse + else: + S.pause = not S.pause + context.area.tag_redraw() + return {'RUNNING_MODAL'} + + if event.type == 'TIMER': + + if not S.pause and S.source_ob.mode == 'OBJECT': + + with self.simulation_mask.masked_context(invert=S.simulation_group_invert): + + for _ in range(S.simulation_steps): + + for i, f in iter_float_factor(S.quad_smoothing, 1, 3, 10): + self.quaternary_links.smooth(f) + + for i, f in iter_float_factor(S.shear_stiffness, 1, 3, 10): + if i > 0: + self.shear_springs.stiff_spring_force(f) + else: + self.shear_springs.soft_spring_force(f, deform_update=S.scale_plasticity, + deform_restore=S.scale_restoration, + min_deform=S.min_scaling, + max_deform=S.max_scaling) + + for i, f in iter_float_factor(S.bending_stiffness, 1, 3, 10): + if i > 0: + self.bending_springs.stiff_spring_force(f) + else: + self.bending_springs.soft_spring_force(f, deform_update=S.scale_plasticity, + deform_restore=S.scale_restoration, + min_deform=S.min_scaling, + max_deform=S.max_scaling) + + for i, f in iter_float_factor(S.structural_stiffness, 1, 3, 10): + if i > 0: + self.structural_springs.stiff_spring_force(f) + else: + self.structural_springs.soft_spring_force(f, deform_update=S.scale_plasticity, + deform_restore=S.scale_restoration, + min_deform=S.min_scaling, + max_deform=S.max_scaling) + + self.engine.kinetic_step(1 - S.damping) + + for i, f in iter_float_factor(S.smooth, 0.5, 3, 5): + self.structural_springs.smooth(f) + + for i, f in iter_float_factor(S.topologic_smooth, 0.5, 3, 5): + self.ternary_links.displacement_force(f) + + self.engine.update_mesh_normals(1) + + f = S.pin_force ** 4 + for i in range(3): + self.pin_cache_update(context, event) + self.pin_cache_apply(context, event, factor=((i + 1) / 3) * f, mouse_factor=1) + + with self.snapping_mask.masked_context(invert=S.snapping_group_invert): + if self.bvh and S.snapping_force > 0: + self.engine.snap_to_bvh(S.snapping_force ** 3, 20 - S.snapping_quality + 1, snapping_mode = S.snapping_mode) + + self.symmetry_map.mirror(*S.mirror) + + self.get_shape(context).data.foreach_set('co', self.engine) + S.source_ob.data.update() + + self.draw_pins(context, event) + + else: + self.pin_cache_update(context, event) + self.draw_pins(context, event) + + return {'PASS_THROUGH'} if not self.mouse_pin_pos else {'RUNNING_MODAL'} + + if event.type == S.mouse_button and event.value == 'PRESS' and S.interact_mouse: + + areas = areas_under_mouse(context, event) + bad_region = False + + for area, regions in areas: + if area.type == 'VIEW_3D': + r_types = set(r.type for r in regions) + if {'UI', 'HEADER', 'TOOLS'} & r_types: + bad_region = True + + if not bad_region and self.mouse_pin_set(context, event, create_empty=event.shift): + return {'RUNNING_MODAL'} + + elif event.type == S.mouse_button and event.value == 'RELEASE': + self.mouse_pin_clear(context, event) + return {'PASS_THROUGH'} + + return {'PASS_THROUGH'} + + +@register_cls +class OBJECT_OT_apply_softwrap(bpy.types.Operator): + bl_idname = 'object.apply_softwrap' + bl_label = 'Apply' + bl_options = {'REGISTER', 'UNDO'} + bl_description = 'Apply the deformation and exit simulation if running' + + @classmethod + def poll(self, context): + return get_settings(context).source_ob + + def execute(self, context): + + shapes = S.source_ob.data.shape_keys + bpy.ops.object.pins_remove_softwrap() + + if shapes and SW_SHAPE_KEY_NAME in shapes.key_blocks: + data = [0] * (len(S.source_ob.data.vertices) * 3) + shapes.key_blocks[SW_SHAPE_KEY_NAME].data.foreach_get('co', data) + S.source_ob.shape_key_remove(shapes.key_blocks[SW_SHAPE_KEY_NAME]) + + if S.source_ob.data.shape_keys: + if len(shapes.key_blocks) == 1: + S.source_ob.shape_key_remove(shapes.key_blocks[0]) + S.source_ob.data.vertices.foreach_set('co', data) + else: + shapes.key_blocks[0].data.foreach_set('co', data) + else: + S.source_ob.data.vertices.foreach_set('co', data) + else: + return {'CANCELLED'} + + if running_op: + running_op.reset_simulation(context) + + return {'FINISHED'} + + +@register_cls +class OBJECT_OT_reset_softwrap(bpy.types.Operator): + bl_idname = 'object.reset_softwrap' + bl_label = 'Reset' + bl_options = {'REGISTER', 'UNDO'} + bl_description = 'Reset the deformation' + + @classmethod + def poll(self, context): + return get_settings(context).source_ob + + def execute(self, context): + + if running_op: + running_op.reset_simulation(context) + + shapes = S.source_ob.data.shape_keys + if shapes and SW_SHAPE_KEY_NAME in shapes.key_blocks: + S.source_ob.shape_key_remove(shapes.key_blocks[SW_SHAPE_KEY_NAME]) + if S.source_ob.data.shape_keys and len(shapes.key_blocks) == 1: + S.source_ob.shape_key_remove(shapes.key_blocks[0]) + return {'FINISHED'} + return {'CANCELLED'} + + +@register_cls +class OBJECT_OT_remove_pins_softwrap(bpy.types.Operator): + bl_idname = 'object.pins_remove_softwrap' + bl_label = 'Delete Pins' + bl_options = {'REGISTER', 'UNDO'} + bl_description = 'Delete all pins assigned to this mesh' + + @classmethod + def poll(self, context): + return get_settings(context).source_ob + + def execute(self, context): + + for pin_obj in S.source_ob.get('sw_pins', []): + bpy.data.objects.remove(pin_obj) + + S.source_ob['sw_pins'] = [] + del S.source_ob['sw_pins'] + return {'FINISHED'} + + +@handlers.persistent +def load_pre_handler(scene): + S().stop_engine(bpy.context) + DrawCallback.remove_all_handlers() + + +def register(): + handlers.load_pre.append(load_pre_handler) + for cls in all_classes: + bpy.utils.register_class(cls) + + bpy.types.Scene.softwrap2 = bpy.props.PointerProperty(type=SoftwrapSettings) + + +def unregister(): + handlers.load_pre.remove(load_pre_handler) + for cls in all_classes: + bpy.utils.unregister_class(cls) + + del bpy.types.Scene.softwrap2 diff --git a/softwrap2/core/core2.cpp b/softwrap2/core/core2.cpp new file mode 100644 index 0000000..cb7f341 --- /dev/null +++ b/softwrap2/core/core2.cpp @@ -0,0 +1,37453 @@ +/* Postprocessed to add #line directives */ +/* Generated by Cython 0.29.28 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [], + "extra_compile_args": [ + "/O2", + "/openmp", + "/fp:fast" + ], + "extra_link_args": [ + "/openmp" + ], + "include_dirs": [ + "core" + ], + "language": "c++", + "name": "softwrap_core2", + "sources": [ + "core/core2.pyx" + ] + }, + "module_name": "softwrap_core2" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.6+ or Python 3.3+. +#else +#define CYTHON_ABI "0_29_28" +#define CYTHON_HEX_VERSION 0x001D1CF0 +#define CYTHON_FUTURE_DIVISION 1 +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef HAVE_LONG_LONG + #if PY_VERSION_HEX >= 0x02070000 + #define HAVE_LONG_LONG + #endif +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 +#elif defined(PYSTON_VERSION) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #if PY_MAJOR_VERSION < 3 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #ifndef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #if PY_VERSION_HEX >= 0x030B00A4 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #elif !defined(CYTHON_FAST_THREAD_STATE) + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #endif + #ifndef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #endif + #if PY_VERSION_HEX >= 0x030B00A4 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #elif !defined(CYTHON_USE_EXC_INFO_STACK) + #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #endif +#endif +#if !defined(CYTHON_FAST_PYCCALL) +#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + #endif + #endif +#else + #include +#endif +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) && __cplusplus >= 201103L + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #elif __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__ ) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif + +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(U other) { return *ptr == other; } + template bool operator !=(U other) { return *ptr != other; } + private: + T *ptr; +}; + +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define Py_OptimizeFlag 0 +#endif +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyClass_Type +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } +#else + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif + #define __Pyx_DefaultClassType PyType_Type +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords +#endif +#if CYTHON_FAST_PYCCALL +#define __Pyx_PyFastCFunction_Check(func)\ + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#else +#define __Pyx_PyFastCFunction_Check(func) 0 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 + #define PyMem_RawMalloc(n) PyMem_Malloc(n) + #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) + #define PyMem_RawFree(p) PyMem_Free(p) +#endif +#if CYTHON_COMPILING_IN_PYSTON + #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x03060000 + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#elif PY_VERSION_HEX >= 0x03000000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_Current +#endif +#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) +#include "pythread.h" +#define Py_tss_NEEDS_INIT 0 +typedef int Py_tss_t; +static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { + *key = PyThread_create_key(); + return 0; +} +static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { + Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); + *key = Py_tss_NEEDS_INIT; + return key; +} +static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { + PyObject_Free(key); +} +static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { + return *key != Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { + PyThread_delete_key(*key); + *key = Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { + return PyThread_set_key_value(*key, value); +} +static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { + return PyThread_get_key_value(*key); +} +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#else +#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if defined(PyUnicode_IS_READY) + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #else + #define __Pyx_PyUnicode_READY(op) (0) + #endif + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #endif +#else + #define CYTHON_PEP393_ENABLED 0 + #define PyUnicode_1BYTE_KIND 1 + #define PyUnicode_2BYTE_KIND 2 + #define PyUnicode_4BYTE_KIND 4 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) + #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#endif +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) +#endif +#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) + #define PyObject_ASCII(o) PyObject_Repr(o) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#ifndef PyObject_Unicode + #define PyObject_Unicode PyObject_Str +#endif +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) +#else + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif +#if PY_VERSION_HEX < 0x030200A4 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) +#else + #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) +#endif +#if CYTHON_USE_ASYNC_SLOTS + #if PY_VERSION_HEX >= 0x030500B1 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods + #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) + #else + #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) + #endif +#else + #define __Pyx_PyType_AsAsync(obj) NULL +#endif +#ifndef __Pyx_PyAsyncMethodsStruct + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + } __Pyx_PyAsyncMethodsStruct; +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) + #define _USE_MATH_DEFINES +#endif +#include +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#define __PYX_MARK_ERR_POS(f_index, lineno) \ + { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#define __PYX_HAVE__softwrap_core2 +#define __PYX_HAVE_API__softwrap_core2 +/* Early includes */ +#include +#include +#include +#include +#include + + template + CYTHON_INLINE T1 nmax(T1 a, T2 b) {return a > b ? a : (T1)b;} + + template + CYTHON_INLINE T1 nmin(T1 a, T2 b) {return a < b ? a : (T1)b;} + + template + CYTHON_INLINE T1 nabs(T1 a) {return a < 0 ? -a : a;} + + template + CYTHON_INLINE T1 nlerp(T1 a, T2 b, T3 t) {return a + (b - a) * t;} + + template + CYTHON_INLINE T1 nclamp(T1 a, T2 min, T3 max) {return nmax(nmin(a, max), min);} + + + + + #define EPS 0.00001f + struct vec3 { + float v[3]; + + vec3 (float a[3]) { + v[0] = a[0]; + v[1] = a[1]; + v[2] = a[2]; + } + + vec3 (float x, float y, float z) { + v[0] = x; + v[1] = y; + v[2] = z; + } + + vec3 (float f) { + v[0] = f; + v[1] = f; + v[2] = f; + } + + vec3() = default; + + #define VEC_OP(op)\ + CYTHON_INLINE vec3 operator op (vec3 other) {\ + return vec3(v[0] op other.v[0], v[1] op other.v[1], v[2] op other.v[2]);\ + } + + VEC_OP(+) + VEC_OP(-) + VEC_OP(*) + VEC_OP(/) + VEC_OP(+=) + VEC_OP(-=) + VEC_OP(*=) + VEC_OP(/=) + + #undef VEC_OP + #define VEC_OP(op)\ + CYTHON_INLINE vec3 operator op (float other) {\ + return vec3(v[0] op other, v[1] op other, v[2] op other);\ + } + + VEC_OP(+) + VEC_OP(-) + VEC_OP(*) + VEC_OP(/) + VEC_OP(+=) + VEC_OP(-=) + VEC_OP(*=) + VEC_OP(/=) + VEC_OP(=) + + #undef VEC_OP + CYTHON_INLINE float& x() { return v[0];} + CYTHON_INLINE float& y() { return v[1];} + CYTHON_INLINE float& z() { return v[2];} + CYTHON_INLINE float sum() {return v[0] + v[1] + v[2];} + CYTHON_INLINE float dot(vec3 other) {return v[0] * other.v[0] + v[1] * other.v[1] + v[2] * other.v[2];} + CYTHON_INLINE float len() {return sqrtf(this->dot(*this));} + CYTHON_INLINE float len_sqr() {return this->dot(*this);} + CYTHON_INLINE void normalize() { + float f = this->len(); + if (f == 0) { + return; + } + f = 1 / f; + *this *= f; + } + CYTHON_INLINE vec3 normalized() { + float f = this->len(); + if (f == 0) { + return *this; + } + f = 1 / f; + return *this * f; + } + CYTHON_INLINE vec3 project(vec3 other) {return other * (this->dot(other) / other.dot(other));} + CYTHON_INLINE vec3 project_unit(vec3 other) {return other * this->dot(other);} + CYTHON_INLINE vec3 cross(vec3 other) { + return vec3(v[1] * other.v[2] - v[2] * other.v[1], + v[2] * other.v[0] - v[0] * other.v[2], + v[0] * other.v[1] - v[1] * other.v[0]); + } + + CYTHON_INLINE vec3 max_aa(vec3 other) { + return vec3(nmax(v[0], other.v[0]), nmax(v[1], other.v[1]), nmax(v[2], other.v[2])); + } + CYTHON_INLINE vec3 min_aa(vec3 other) { + return vec3(nmin(v[0], other.v[0]), nmin(v[1], other.v[1]), nmin(v[2], other.v[2])); + } + CYTHON_INLINE vec3 lerp(vec3 other, float fac) { + return *this + (other - *this) * fac; + } + CYTHON_INLINE vec3 clamp(float min, float max) { + float d = this->dot(*this); + if (d == 0) { + return *this; + } + else if (d < min * min) { + return *this * (1 / sqrtf(d) * min); + } + else if (d > max * max) { + return *this * (1 / sqrtf(d) * max); + } + return *this; + } + }; + + + CYTHON_INLINE vec3 project_point_triangle(vec3& a, vec3& b, vec3& c, vec3& n, vec3& p){ + vec3 edge_v = b - a; + vec3 pv = p - a; + vec3 n1 = edge_v.cross(pv); + + if (n1.dot(n) < 0){ + return edge_v * nclamp(edge_v.dot(pv) / (edge_v.dot(edge_v) + EPS), 0, 1) + a; + } + + edge_v = c - b; + pv = p - b; + n1 = edge_v.cross(pv); + + if (n1.dot(n) < 0){ + return edge_v * nclamp(edge_v.dot(pv) / (edge_v.dot(edge_v) + EPS), 0, 1) + b; + } + + edge_v = a - c; + pv = p - c; + n1 = edge_v.cross(pv); + + if (n1.dot(n) < 0){ + return edge_v * nclamp(edge_v.dot(pv) / (edge_v.dot(edge_v) + EPS), 0, 1) + c; + } + + return p - pv.project_unit(n); + } + + CYTHON_INLINE vec3 project_point_plane(vec3& p, vec3& pp, vec3& pn){ + vec3 v = (p - pp).project_unit(pn); + return p - v; + } + + + #include + + union BvhNode; + struct BvhNodeBox; + struct BvhNodeLeaf; + + struct BvhNodeBox { + int split_axis; + float split_pos; + vec3 min, max; + BvhNode* nodes[2]; + + // BvhNodeBox() { + // split_axis = -1; + // min = vec3(INFINITY); + // max = vec3(-INFINITY); + // } + // CYTHON_INLINE void expand(BvhNodeBox other) { + // min = min.min_aa(other.min); + // max = max.max_aa(other.max); + // } + CYTHON_INLINE void expand(vec3 other) { + min = min.min_aa(other); + max = max.max_aa(other); + } + CYTHON_INLINE int major_axis(){ + int axis = 0; + float curr_le, le = 0; + + for (int i=0; i<3; i++){ + curr_le = max.v[i] - min.v[i]; + if (curr_le > le){ + axis = i; + le = curr_le; + } + } + return axis; + } + CYTHON_INLINE vec3 box_center(){ + return (max + min) * 0.5; + } + CYTHON_INLINE float box_center_axis(int axis){ + return (max.v[axis] + min.v[axis]) * 0.5f; + } + CYTHON_INLINE float box_distance_sqr(vec3 p){ + return (p - max.min_aa(min.max_aa(p))).len_sqr(); + } + CYTHON_INLINE void set_split_axis(int axis){ + this->split_axis = ~axis; + } + CYTHON_INLINE int get_split_axis(){ + return ~this->split_axis; + } + CYTHON_INLINE int is_leaf() { + return split_axis >= 0; + } + }; + + struct BvhNodeLeaf { + int index; + // BvhNodeLeaf (int _index) { + // index = _index; + // } + }; + + union BvhNode{ + BvhNodeBox box; + BvhNodeLeaf leaf; + CYTHON_INLINE int is_leaf() { + return leaf.index >= 0; + } + }; + + struct BvhNearestResult { + vec3 point; + float distance; + int tri_index; + }; + + + struct HalfLink { + int a; + float original_length; + float scale; + }; + + struct HalfLinkArr { + int n; + HalfLink half_links[]; + }; + + + struct TernaryLink { + int a, b; + int side; + float avg_dist; + }; + + struct TernaryLinkArr { + int n; + TernaryLink arr[]; + }; + +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) +#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#else +#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) +#endif +#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + const char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + if (strcmp(default_encoding_c, "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (!ascii_chars_u) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + Py_DECREF(ascii_chars_u); + Py_DECREF(ascii_chars_b); + } + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); + if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } + +static PyObject *__pyx_m = NULL; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_cython_runtime = NULL; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static PyObject *__pyx_empty_unicode; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "core\\core2.pyx", + "stringsource", +}; +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + + +/*--- Type declarations ---*/ +struct __pyx_obj_14softwrap_core2_Mesh; +struct __pyx_obj_14softwrap_core2_BVH; +struct __pyx_obj_14softwrap_core2_LinkProbe; +struct __pyx_obj_14softwrap_core2_SpringLinks; +struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks; +struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks; +struct __pyx_obj_14softwrap_core2_SpringEnginePin; +struct __pyx_obj_14softwrap_core2__MaskContextManager; +struct __pyx_obj_14softwrap_core2_SpringEngineMask; +struct __pyx_obj_14softwrap_core2_SymmetryMap; +struct __pyx_obj_14softwrap_core2_SpringEngine; +struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__; +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__; +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring; +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__; +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__; +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr; +struct __pyx_opt_args_14softwrap_core2_11SpringLinks_soft_spring_force; +struct __pyx_t_14softwrap_core2_QuaternaryLink; +struct __pyx_opt_args_14softwrap_core2_24QuaternarySmoothingLinks_smooth; +struct __pyx_opt_args_14softwrap_core2_16SpringEngineMask_masked_store; +struct __pyx_opt_args_14softwrap_core2_12SpringEngine_random_verts; + +/* "core/core2.pyx":830 + * + * + * cpdef void soft_spring_force(self, float factor, float deform_update=0.3, float deform_restore=0.03, float min_deform=0.3, float max_deform=3.0): # <<<<<<<<<<<<<< + * cdef int i, j, n, a + * cdef HalfLink* half_links + */ + +# line 830 "core/core2.pyx" +struct __pyx_opt_args_14softwrap_core2_11SpringLinks_soft_spring_force { + +# line 830 "core/core2.pyx" + int __pyx_n; + +# line 830 "core/core2.pyx" + float deform_update; + +# line 830 "core/core2.pyx" + float deform_restore; + +# line 830 "core/core2.pyx" + float min_deform; + +# line 830 "core/core2.pyx" + float max_deform; + +# line 830 "core/core2.pyx" +}; + +/* "core/core2.pyx":1012 + * + * + * cdef struct QuaternaryLink: # <<<<<<<<<<<<<< + * int a, b, c, d + * float ratio + */ + +# line 1012 "core/core2.pyx" +struct __pyx_t_14softwrap_core2_QuaternaryLink { + +# line 1012 "core/core2.pyx" + int a; + +# line 1012 "core/core2.pyx" + int b; + +# line 1012 "core/core2.pyx" + int c; + +# line 1012 "core/core2.pyx" + int d; + +# line 1012 "core/core2.pyx" + float ratio; + +# line 1012 "core/core2.pyx" + int side; + +# line 1012 "core/core2.pyx" +}; + +/* "core/core2.pyx":1069 + * lnk.side = ab.dot(cd) > 1 + * + * cpdef void smooth(self, float factor, float max_ratio=3): # <<<<<<<<<<<<<< + * cdef int i + * cdef QuaternaryLink* lnk + */ + +# line 1069 "core/core2.pyx" +struct __pyx_opt_args_14softwrap_core2_24QuaternarySmoothingLinks_smooth { + +# line 1069 "core/core2.pyx" + int __pyx_n; + +# line 1069 "core/core2.pyx" + float max_ratio; + +# line 1069 "core/core2.pyx" +}; + +/* "core/core2.pyx":1279 + * self.engine.m.verts[i] = self.vec_data[i] + * + * cpdef void masked_store(self, float factor=1, bint invert=False): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + +# line 1279 "core/core2.pyx" +struct __pyx_opt_args_14softwrap_core2_16SpringEngineMask_masked_store { + +# line 1279 "core/core2.pyx" + int __pyx_n; + +# line 1279 "core/core2.pyx" + float factor; + +# line 1279 "core/core2.pyx" + int invert; + +# line 1279 "core/core2.pyx" +}; + +/* "core/core2.pyx":1530 + * return SpringEngineMask(self, mask) + * + * cpdef void random_verts(self, float factor, unsigned int seed=0x452821E6): # <<<<<<<<<<<<<< + * cdef int i + * cdef unsigned int xorstate = 0x452821E6 + */ + +# line 1530 "core/core2.pyx" +struct __pyx_opt_args_14softwrap_core2_12SpringEngine_random_verts { + +# line 1530 "core/core2.pyx" + int __pyx_n; + +# line 1530 "core/core2.pyx" + unsigned int seed; + +# line 1530 "core/core2.pyx" +}; + +/* "core/core2.pyx":326 + * + * @cython.final + * cdef class Mesh: # <<<<<<<<<<<<<< + * cdef: + * vec3* verts + */ + +# line 326 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_Mesh { + +# line 326 "core/core2.pyx" + PyObject_HEAD + +# line 326 "core/core2.pyx" + struct __pyx_vtabstruct_14softwrap_core2_Mesh *__pyx_vtab; + +# line 326 "core/core2.pyx" + vec3 *verts; + +# line 326 "core/core2.pyx" + int (*triangles)[3]; + +# line 326 "core/core2.pyx" + vec3 *centroids; + +# line 326 "core/core2.pyx" + vec3 *vert_normals; + +# line 326 "core/core2.pyx" + vec3 *face_normals; + +# line 326 "core/core2.pyx" + int n_verts; + +# line 326 "core/core2.pyx" + int n_triangles; + +# line 326 "core/core2.pyx" +}; + + +/* "core/core2.pyx":554 + * + * @cython.final + * cdef class BVH: # <<<<<<<<<<<<<< + * cdef: + * BvhNodeLeaf* leaves + */ + +# line 554 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_BVH { + +# line 554 "core/core2.pyx" + PyObject_HEAD + +# line 554 "core/core2.pyx" + struct __pyx_vtabstruct_14softwrap_core2_BVH *__pyx_vtab; + +# line 554 "core/core2.pyx" + BvhNodeLeaf *leaves; + +# line 554 "core/core2.pyx" + BvhNodeBox *boxes; + +# line 554 "core/core2.pyx" + union BvhNode *root; + +# line 554 "core/core2.pyx" + int free_box_idx; + +# line 554 "core/core2.pyx" + int size; + +# line 554 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_Mesh *mesh; + +# line 554 "core/core2.pyx" +}; + + +/* "core/core2.pyx":712 + * + * @cython.final + * cdef class LinkProbe: # <<<<<<<<<<<<<< + * cdef readonly SpringLinks springs + * cdef HalfLinkArr* halflinks + */ + +# line 712 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_LinkProbe { + +# line 712 "core/core2.pyx" + PyObject_HEAD + +# line 712 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringLinks *springs; + +# line 712 "core/core2.pyx" + struct HalfLinkArr *halflinks; + +# line 712 "core/core2.pyx" + int index; + +# line 712 "core/core2.pyx" +}; + + +/* "core/core2.pyx":747 + * return r / (self.halflinks.n + EPS) + * + * cdef class SpringLinks: # <<<<<<<<<<<<<< + * + * cdef readonly SpringEngine engine + */ + +# line 747 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_SpringLinks { + +# line 747 "core/core2.pyx" + PyObject_HEAD + +# line 747 "core/core2.pyx" + struct __pyx_vtabstruct_14softwrap_core2_SpringLinks *__pyx_vtab; + +# line 747 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEngine *engine; + +# line 747 "core/core2.pyx" + int max_links; + +# line 747 "core/core2.pyx" + struct HalfLinkArr **links; + +# line 747 "core/core2.pyx" +}; + + +/* "core/core2.pyx":915 + * + * @cython.final + * cdef class TernarySmoothingLinks: # <<<<<<<<<<<<<< + * cdef readonly SpringEngine engine + * cdef TernaryLinkArr** links + */ + +# line 915 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks { + +# line 915 "core/core2.pyx" + PyObject_HEAD + +# line 915 "core/core2.pyx" + struct __pyx_vtabstruct_14softwrap_core2_TernarySmoothingLinks *__pyx_vtab; + +# line 915 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEngine *engine; + +# line 915 "core/core2.pyx" + struct TernaryLinkArr **links; + +# line 915 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1017 + * int side + * + * cdef class QuaternarySmoothingLinks: # <<<<<<<<<<<<<< + * cdef readonly SpringEngine engine + * cdef readonly int n_links + */ + +# line 1017 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks { + +# line 1017 "core/core2.pyx" + PyObject_HEAD + +# line 1017 "core/core2.pyx" + struct __pyx_vtabstruct_14softwrap_core2_QuaternarySmoothingLinks *__pyx_vtab; + +# line 1017 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEngine *engine; + +# line 1017 "core/core2.pyx" + int n_links; + +# line 1017 "core/core2.pyx" + struct __pyx_t_14softwrap_core2_QuaternaryLink *links; + +# line 1017 "core/core2.pyx" + int *accum_n; + +# line 1017 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1108 + * + * @cython.final + * cdef class SpringEnginePin: # <<<<<<<<<<<<<< + * cdef readonly SpringEngine engine + * cdef readonly int n_rings + */ + +# line 1108 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_SpringEnginePin { + +# line 1108 "core/core2.pyx" + PyObject_HEAD + +# line 1108 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEngine *engine; + +# line 1108 "core/core2.pyx" + int n_rings; + +# line 1108 "core/core2.pyx" + int start_index; + +# line 1108 "core/core2.pyx" + int **rings; + +# line 1108 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1192 + * + * + * cdef class _MaskContextManager: # <<<<<<<<<<<<<< + * cdef SpringEngineMask mask + * cdef float factor + */ + +# line 1192 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2__MaskContextManager { + +# line 1192 "core/core2.pyx" + PyObject_HEAD + +# line 1192 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEngineMask *mask; + +# line 1192 "core/core2.pyx" + float factor; + +# line 1192 "core/core2.pyx" + int invert; + +# line 1192 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1210 + * + * + * cdef class SpringEngineMask: # <<<<<<<<<<<<<< + * cdef float* mask + * cdef vec3* vec_data + */ + +# line 1210 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_SpringEngineMask { + +# line 1210 "core/core2.pyx" + PyObject_HEAD + +# line 1210 "core/core2.pyx" + struct __pyx_vtabstruct_14softwrap_core2_SpringEngineMask *__pyx_vtab; + +# line 1210 "core/core2.pyx" + float *mask; + +# line 1210 "core/core2.pyx" + vec3 *vec_data; + +# line 1210 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEngine *engine; + +# line 1210 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1313 + * + * @cython.final + * cdef class SymmetryMap: # <<<<<<<<<<<<<< + * cdef int* symm_map + * cdef SpringEngine engine + */ + +# line 1313 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_SymmetryMap { + +# line 1313 "core/core2.pyx" + PyObject_HEAD + +# line 1313 "core/core2.pyx" + struct __pyx_vtabstruct_14softwrap_core2_SymmetryMap *__pyx_vtab; + +# line 1313 "core/core2.pyx" + int *symm_map; + +# line 1313 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEngine *engine; + +# line 1313 "core/core2.pyx" + float error[3]; + +# line 1313 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1376 + * + * + * cdef class SpringEngine: # <<<<<<<<<<<<<< + * cdef Mesh m + * cdef vec3* prev_verts + */ + +# line 1376 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2_SpringEngine { + +# line 1376 "core/core2.pyx" + PyObject_HEAD + +# line 1376 "core/core2.pyx" + struct __pyx_vtabstruct_14softwrap_core2_SpringEngine *__pyx_vtab; + +# line 1376 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_Mesh *m; + +# line 1376 "core/core2.pyx" + vec3 *prev_verts; + +# line 1376 "core/core2.pyx" + vec3 *tmp_verts; + +# line 1376 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_BVH *bvh; + +# line 1376 "core/core2.pyx" + int *bvh_closest_indexes; + +# line 1376 "core/core2.pyx" + unsigned int snap_count; + +# line 1376 "core/core2.pyx" + int n_verts; + +# line 1376 "core/core2.pyx" +}; + + +/* "core/core2.pyx":733 + * return self.halflinks.n + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.halflinks.n): + */ + +# line 733 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ { + +# line 733 "core/core2.pyx" + PyObject_HEAD + +# line 733 "core/core2.pyx" + int __pyx_v_i; + +# line 733 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self; + +# line 733 "core/core2.pyx" + int __pyx_t_0; + +# line 733 "core/core2.pyx" + int __pyx_t_1; + +# line 733 "core/core2.pyx" + int __pyx_t_2; + +# line 733 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1157 + * self.rings[i][j + 1] = front[j] + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if index < 0 or index >= self.n_rings: + * raise IndexError + */ + +# line 1157 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ { + +# line 1157 "core/core2.pyx" + PyObject_HEAD + +# line 1157 "core/core2.pyx" + int __pyx_v_index; + +# line 1157 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self; + +# line 1157 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1161 + * raise IndexError + * + * def iter_ring(): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.rings[index][0]): + */ + +# line 1161 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring { + +# line 1161 "core/core2.pyx" + PyObject_HEAD + +# line 1161 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *__pyx_outer_scope; + +# line 1161 "core/core2.pyx" + int __pyx_v_i; + +# line 1161 "core/core2.pyx" + int __pyx_t_0; + +# line 1161 "core/core2.pyx" + int __pyx_t_1; + +# line 1161 "core/core2.pyx" + int __pyx_t_2; + +# line 1161 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1168 + * return iter_ring() + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.n_rings): + */ + +# line 1168 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ { + +# line 1168 "core/core2.pyx" + PyObject_HEAD + +# line 1168 "core/core2.pyx" + int __pyx_v_i; + +# line 1168 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self; + +# line 1168 "core/core2.pyx" + int __pyx_t_0; + +# line 1168 "core/core2.pyx" + int __pyx_t_1; + +# line 1168 "core/core2.pyx" + int __pyx_t_2; + +# line 1168 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1348 + * self.error[axis] = nmax(dist, self.error[axis]) + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if index < 0 or index >= self.engine.n_verts: + * raise KeyError + */ + +# line 1348 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ { + +# line 1348 "core/core2.pyx" + PyObject_HEAD + +# line 1348 "core/core2.pyx" + int __pyx_v_index; + +# line 1348 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self; + +# line 1348 "core/core2.pyx" +}; + + +/* "core/core2.pyx":1352 + * raise KeyError + * + * return tuple(self.symm_map[index + axis * self.engine.n_verts] for axis in range(3)) # <<<<<<<<<<<<<< + * + * cpdef void mirror(self, bint x, bint y, bint z): + */ + +# line 1352 "core/core2.pyx" +struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr { + +# line 1352 "core/core2.pyx" + PyObject_HEAD + +# line 1352 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *__pyx_outer_scope; + +# line 1352 "core/core2.pyx" + PyObject *__pyx_v_axis; + +# line 1352 "core/core2.pyx" + long __pyx_t_0; + +# line 1352 "core/core2.pyx" +}; + + + +/* "core/core2.pyx":326 + * + * @cython.final + * cdef class Mesh: # <<<<<<<<<<<<<< + * cdef: + * vec3* verts + */ + + +# line 326 "core/core2.pyx" +struct __pyx_vtabstruct_14softwrap_core2_Mesh { + +# line 326 "core/core2.pyx" + vec3 *(*tri_vert_ptr)(struct __pyx_obj_14softwrap_core2_Mesh *, int, int); + +# line 326 "core/core2.pyx" + vec3 (*tri_vert)(struct __pyx_obj_14softwrap_core2_Mesh *, int, int); + +# line 326 "core/core2.pyx" + void (*update_face_normals)(struct __pyx_obj_14softwrap_core2_Mesh *, int __pyx_skip_dispatch); + +# line 326 "core/core2.pyx" + void (*update_vert_normals)(struct __pyx_obj_14softwrap_core2_Mesh *, int __pyx_skip_dispatch); + +# line 326 "core/core2.pyx" + void (*update_centroids)(struct __pyx_obj_14softwrap_core2_Mesh *, int __pyx_skip_dispatch); + +# line 326 "core/core2.pyx" +}; + +# line 326 "core/core2.pyx" +static struct __pyx_vtabstruct_14softwrap_core2_Mesh *__pyx_vtabptr_14softwrap_core2_Mesh; + +# line 326 "core/core2.pyx" +static CYTHON_INLINE vec3 *__pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr(struct __pyx_obj_14softwrap_core2_Mesh *, int, int); + +# line 326 "core/core2.pyx" +static CYTHON_INLINE vec3 __pyx_f_14softwrap_core2_4Mesh_tri_vert(struct __pyx_obj_14softwrap_core2_Mesh *, int, int); + +# line 326 "core/core2.pyx" +static void __pyx_f_14softwrap_core2_4Mesh_update_face_normals(struct __pyx_obj_14softwrap_core2_Mesh *, int __pyx_skip_dispatch); + +# line 326 "core/core2.pyx" +static void __pyx_f_14softwrap_core2_4Mesh_update_vert_normals(struct __pyx_obj_14softwrap_core2_Mesh *, int __pyx_skip_dispatch); + +# line 326 "core/core2.pyx" +static void __pyx_f_14softwrap_core2_4Mesh_update_centroids(struct __pyx_obj_14softwrap_core2_Mesh *, int __pyx_skip_dispatch); + + +/* "core/core2.pyx":554 + * + * @cython.final + * cdef class BVH: # <<<<<<<<<<<<<< + * cdef: + * BvhNodeLeaf* leaves + */ + + +# line 554 "core/core2.pyx" +struct __pyx_vtabstruct_14softwrap_core2_BVH { + +# line 554 "core/core2.pyx" + BvhNodeBox *(*pop_box)(struct __pyx_obj_14softwrap_core2_BVH *); + +# line 554 "core/core2.pyx" + union BvhNode *(*build_tree)(struct __pyx_obj_14softwrap_core2_BVH *, BvhNodeLeaf *, int); + +# line 554 "core/core2.pyx" + struct BvhNearestResult (*_find_nearest)(struct __pyx_obj_14softwrap_core2_BVH *, vec3); + +# line 554 "core/core2.pyx" + void (*find_nearest_recursive)(struct __pyx_obj_14softwrap_core2_BVH *, vec3 *, struct BvhNearestResult *, union BvhNode *); + +# line 554 "core/core2.pyx" +}; + +# line 554 "core/core2.pyx" +static struct __pyx_vtabstruct_14softwrap_core2_BVH *__pyx_vtabptr_14softwrap_core2_BVH; + +# line 554 "core/core2.pyx" +static CYTHON_INLINE BvhNodeBox *__pyx_f_14softwrap_core2_3BVH_pop_box(struct __pyx_obj_14softwrap_core2_BVH *); + +# line 554 "core/core2.pyx" +static union BvhNode *__pyx_f_14softwrap_core2_3BVH_build_tree(struct __pyx_obj_14softwrap_core2_BVH *, BvhNodeLeaf *, int); + +# line 554 "core/core2.pyx" +static CYTHON_INLINE struct BvhNearestResult __pyx_f_14softwrap_core2_3BVH__find_nearest(struct __pyx_obj_14softwrap_core2_BVH *, vec3); + +# line 554 "core/core2.pyx" +static void __pyx_f_14softwrap_core2_3BVH_find_nearest_recursive(struct __pyx_obj_14softwrap_core2_BVH *, vec3 *, struct BvhNearestResult *, union BvhNode *); + + +/* "core/core2.pyx":747 + * return r / (self.halflinks.n + EPS) + * + * cdef class SpringLinks: # <<<<<<<<<<<<<< + * + * cdef readonly SpringEngine engine + */ + + +# line 747 "core/core2.pyx" +struct __pyx_vtabstruct_14softwrap_core2_SpringLinks { + +# line 747 "core/core2.pyx" + void (*lengths_update)(struct __pyx_obj_14softwrap_core2_SpringLinks *, int __pyx_skip_dispatch); + +# line 747 "core/core2.pyx" + void (*smooth)(struct __pyx_obj_14softwrap_core2_SpringLinks *, float, int __pyx_skip_dispatch); + +# line 747 "core/core2.pyx" + void (*soft_spring_force)(struct __pyx_obj_14softwrap_core2_SpringLinks *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_11SpringLinks_soft_spring_force *__pyx_optional_args); + +# line 747 "core/core2.pyx" + void (*stiff_spring_force)(struct __pyx_obj_14softwrap_core2_SpringLinks *, float, int __pyx_skip_dispatch); + +# line 747 "core/core2.pyx" +}; + +# line 747 "core/core2.pyx" +static struct __pyx_vtabstruct_14softwrap_core2_SpringLinks *__pyx_vtabptr_14softwrap_core2_SpringLinks; + + +/* "core/core2.pyx":915 + * + * @cython.final + * cdef class TernarySmoothingLinks: # <<<<<<<<<<<<<< + * cdef readonly SpringEngine engine + * cdef TernaryLinkArr** links + */ + + +# line 915 "core/core2.pyx" +struct __pyx_vtabstruct_14softwrap_core2_TernarySmoothingLinks { + +# line 915 "core/core2.pyx" + void (*displacements_update)(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *, int __pyx_skip_dispatch); + +# line 915 "core/core2.pyx" + void (*displacement_force)(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *, float, int __pyx_skip_dispatch); + +# line 915 "core/core2.pyx" +}; + +# line 915 "core/core2.pyx" +static struct __pyx_vtabstruct_14softwrap_core2_TernarySmoothingLinks *__pyx_vtabptr_14softwrap_core2_TernarySmoothingLinks; + +# line 915 "core/core2.pyx" +static void __pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacements_update(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *, int __pyx_skip_dispatch); + +# line 915 "core/core2.pyx" +static void __pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacement_force(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *, float, int __pyx_skip_dispatch); + + +/* "core/core2.pyx":1017 + * int side + * + * cdef class QuaternarySmoothingLinks: # <<<<<<<<<<<<<< + * cdef readonly SpringEngine engine + * cdef readonly int n_links + */ + + +# line 1017 "core/core2.pyx" +struct __pyx_vtabstruct_14softwrap_core2_QuaternarySmoothingLinks { + +# line 1017 "core/core2.pyx" + void (*lengths_update)(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *, int __pyx_skip_dispatch); + +# line 1017 "core/core2.pyx" + void (*smooth)(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_24QuaternarySmoothingLinks_smooth *__pyx_optional_args); + +# line 1017 "core/core2.pyx" +}; + +# line 1017 "core/core2.pyx" +static struct __pyx_vtabstruct_14softwrap_core2_QuaternarySmoothingLinks *__pyx_vtabptr_14softwrap_core2_QuaternarySmoothingLinks; + + +/* "core/core2.pyx":1210 + * + * + * cdef class SpringEngineMask: # <<<<<<<<<<<<<< + * cdef float* mask + * cdef vec3* vec_data + */ + + +# line 1210 "core/core2.pyx" +struct __pyx_vtabstruct_14softwrap_core2_SpringEngineMask { + +# line 1210 "core/core2.pyx" + PyObject *(*set_force)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, float, float, float, int __pyx_skip_dispatch); + +# line 1210 "core/core2.pyx" + void (*load)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, int __pyx_skip_dispatch); + +# line 1210 "core/core2.pyx" + void (*store)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, int __pyx_skip_dispatch); + +# line 1210 "core/core2.pyx" + void (*masked_store)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_16SpringEngineMask_masked_store *__pyx_optional_args); + +# line 1210 "core/core2.pyx" + PyObject *(*set)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, PyObject *, int __pyx_skip_dispatch); + +# line 1210 "core/core2.pyx" +}; + +# line 1210 "core/core2.pyx" +static struct __pyx_vtabstruct_14softwrap_core2_SpringEngineMask *__pyx_vtabptr_14softwrap_core2_SpringEngineMask; + + +/* "core/core2.pyx":1313 + * + * @cython.final + * cdef class SymmetryMap: # <<<<<<<<<<<<<< + * cdef int* symm_map + * cdef SpringEngine engine + */ + + +# line 1313 "core/core2.pyx" +struct __pyx_vtabstruct_14softwrap_core2_SymmetryMap { + +# line 1313 "core/core2.pyx" + void (*mirror)(struct __pyx_obj_14softwrap_core2_SymmetryMap *, int, int, int, int __pyx_skip_dispatch); + +# line 1313 "core/core2.pyx" +}; + +# line 1313 "core/core2.pyx" +static struct __pyx_vtabstruct_14softwrap_core2_SymmetryMap *__pyx_vtabptr_14softwrap_core2_SymmetryMap; + +# line 1313 "core/core2.pyx" +static void __pyx_f_14softwrap_core2_11SymmetryMap_mirror(struct __pyx_obj_14softwrap_core2_SymmetryMap *, int, int, int, int __pyx_skip_dispatch); + + +/* "core/core2.pyx":1376 + * + * + * cdef class SpringEngine: # <<<<<<<<<<<<<< + * cdef Mesh m + * cdef vec3* prev_verts + */ + + +# line 1376 "core/core2.pyx" +struct __pyx_vtabstruct_14softwrap_core2_SpringEngine { + +# line 1376 "core/core2.pyx" + void (*set_bvh)(struct __pyx_obj_14softwrap_core2_SpringEngine *, struct __pyx_obj_14softwrap_core2_BVH *, int __pyx_skip_dispatch); + +# line 1376 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringLinks *(*create_spring_group)(struct __pyx_obj_14softwrap_core2_SpringEngine *, PyObject *, int __pyx_skip_dispatch); + +# line 1376 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SymmetryMap *(*create_symmetry_map)(struct __pyx_obj_14softwrap_core2_SpringEngine *, int __pyx_skip_dispatch); + +# line 1376 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *(*create_ternary_links)(struct __pyx_obj_14softwrap_core2_SpringEngine *, PyObject *, int __pyx_skip_dispatch); + +# line 1376 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *(*create_quaternary_links)(struct __pyx_obj_14softwrap_core2_SpringEngine *, PyObject *, int __pyx_skip_dispatch); + +# line 1376 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2_SpringEngineMask *(*create_mask)(struct __pyx_obj_14softwrap_core2_SpringEngine *, PyObject *, int __pyx_skip_dispatch); + +# line 1376 "core/core2.pyx" + void (*random_verts)(struct __pyx_obj_14softwrap_core2_SpringEngine *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_12SpringEngine_random_verts *__pyx_optional_args); + +# line 1376 "core/core2.pyx" + void (*kinetic_step)(struct __pyx_obj_14softwrap_core2_SpringEngine *, float, int __pyx_skip_dispatch); + +# line 1376 "core/core2.pyx" + void (*update_mesh_normals)(struct __pyx_obj_14softwrap_core2_SpringEngine *, float, int __pyx_skip_dispatch); + +# line 1376 "core/core2.pyx" +}; + +# line 1376 "core/core2.pyx" +static struct __pyx_vtabstruct_14softwrap_core2_SpringEngine *__pyx_vtabptr_14softwrap_core2_SpringEngine; + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif +#if CYTHON_FAST_PYCALL + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) + #define __Pyx_PyFrame_GetLocalsplus(frame)\ + (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif // CYTHON_FAST_PYCALL +#endif + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallNoArg.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif + +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* UnpackTupleError.proto */ +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); + +/* UnpackTuple2.proto */ +#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\ + (likely(is_tuple || PyTuple_Check(tuple)) ?\ + (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\ + __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\ + (__Pyx_UnpackTupleError(tuple, 2), -1)) :\ + __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple)) +static CYTHON_INLINE int __Pyx_unpack_tuple2_exact( + PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple); +static int __Pyx_unpack_tuple2_generic( + PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple); + +/* dict_iter.proto */ +static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name, + Py_ssize_t* p_orig_length, int* p_is_dict); +static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, + PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); + +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif PY_MAJOR_VERSION < 3 + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_str(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_str(s) :\ + PyObject_Format(s, f)) +#else + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#endif + +/* IncludeStringH.proto */ +#include + +/* JoinPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* RaiseArgTupleInvalid.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); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ + const char* function_name); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* append.proto */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); + +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* pyfrozenset_new.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it); + +/* PySetContains.proto */ +static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq); + +/* None.proto */ +static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); + +/* FetchCommonType.proto */ +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); + +/* CythonFunctionShared.proto */ +#define __Pyx_CyFunction_USED 1 +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { + PyCFunctionObject func; +#if PY_VERSION_HEX < 0x030500A0 + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; + void *defaults; + int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; +} __pyx_CyFunctionObject; +static PyTypeObject *__pyx_CyFunctionType = 0; +#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *self, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(void); + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* DictGetItem.proto */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) +#else +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) +#endif + +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyObject_GenericGetAttrNoDict.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#endif + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyObject *dict, void *vtable); + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* SetupReduce.proto */ +static int __Pyx_setup_reduce(PyObject* type_obj); + +/* PyObject_GenericGetAttr.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#else +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#endif + +/* CodeObjectCache.proto */ +typedef struct { + PyCodeObject* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* GCCDiagnostics.proto */ +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* CoroutineBase.proto */ +typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; + PyObject *gi_weakreflist; + PyObject *classobj; + PyObject *yieldfrom; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Coroutine_Close(PyObject *self); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); + +/* PatchModuleWithCoroutine.proto */ +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); + +/* PatchGeneratorABC.proto */ +static int __Pyx_patch_abc(void); + +/* Generator.proto */ +#define __Pyx_Generator_USED +static PyTypeObject *__pyx_GeneratorType = 0; +#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(void); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(void); + +/* InitStrings.proto */ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + +static CYTHON_INLINE vec3 *__pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, int __pyx_v_tri, int __pyx_v_tri_i); /* proto*/ +static CYTHON_INLINE vec3 __pyx_f_14softwrap_core2_4Mesh_tri_vert(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, int __pyx_v_tri, int __pyx_v_tri_i); /* proto*/ +static void __pyx_f_14softwrap_core2_4Mesh_update_face_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_4Mesh_update_vert_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_4Mesh_update_centroids(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/ +static CYTHON_INLINE BvhNodeBox *__pyx_f_14softwrap_core2_3BVH_pop_box(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self); /* proto*/ +static union BvhNode *__pyx_f_14softwrap_core2_3BVH_build_tree(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, BvhNodeLeaf *__pyx_v_leaves, int __pyx_v_size); /* proto*/ +static CYTHON_INLINE struct BvhNearestResult __pyx_f_14softwrap_core2_3BVH__find_nearest(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, vec3 __pyx_v_p); /* proto*/ +static void __pyx_f_14softwrap_core2_3BVH_find_nearest_recursive(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, vec3 *__pyx_v_p, struct BvhNearestResult *__pyx_v_out, union BvhNode *__pyx_v_node); /* proto*/ +static void __pyx_f_14softwrap_core2_11SpringLinks_lengths_update(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_11SpringLinks_smooth(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_11SpringLinks_soft_spring_force(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_11SpringLinks_soft_spring_force *__pyx_optional_args); /* proto*/ +static void __pyx_f_14softwrap_core2_11SpringLinks_stiff_spring_force(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacements_update(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacement_force(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, float __pyx_v_factor, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_24QuaternarySmoothingLinks_lengths_update(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_24QuaternarySmoothingLinks_smooth(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_24QuaternarySmoothingLinks_smooth *__pyx_optional_args); /* proto*/ +static PyObject *__pyx_f_14softwrap_core2_16SpringEngineMask_set_force(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_16SpringEngineMask_load(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_16SpringEngineMask_store(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_16SpringEngineMask_masked_store(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_16SpringEngineMask_masked_store *__pyx_optional_args); /* proto*/ +static PyObject *__pyx_f_14softwrap_core2_16SpringEngineMask_set(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, PyObject *__pyx_v_vec_data, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_11SymmetryMap_mirror(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, int __pyx_v_x, int __pyx_v_y, int __pyx_v_z, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_12SpringEngine_set_bvh(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_bvh, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_f_14softwrap_core2_12SpringEngine_create_spring_group(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_f_14softwrap_core2_12SpringEngine_create_symmetry_map(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_f_14softwrap_core2_12SpringEngine_create_ternary_links(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_f_14softwrap_core2_12SpringEngine_create_quaternary_links(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links, int __pyx_skip_dispatch); /* proto*/ +static struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_f_14softwrap_core2_12SpringEngine_create_mask(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_mask, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_12SpringEngine_random_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_12SpringEngine_random_verts *__pyx_optional_args); /* proto*/ +static void __pyx_f_14softwrap_core2_12SpringEngine_kinetic_step(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_damping, int __pyx_skip_dispatch); /* proto*/ +static void __pyx_f_14softwrap_core2_12SpringEngine_update_mesh_normals(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch); /* proto*/ + +/* Module declarations from 'libc.math' */ + +/* Module declarations from 'libc.limits' */ + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'libc.stdint' */ + +/* Module declarations from 'cython' */ + +/* Module declarations from 'softwrap_core2' */ +static PyTypeObject *__pyx_ptype_14softwrap_core2_Mesh = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2_BVH = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2_LinkProbe = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2_SpringLinks = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2_TernarySmoothingLinks = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2_QuaternarySmoothingLinks = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2_SpringEnginePin = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2__MaskContextManager = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2_SpringEngineMask = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2_SymmetryMap = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2_SpringEngine = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2___pyx_scope_struct____iter__ = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2___pyx_scope_struct_1___getitem__ = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2___pyx_scope_struct_2_iter_ring = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2___pyx_scope_struct_3___iter__ = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2___pyx_scope_struct_4___getitem__ = 0; +static PyTypeObject *__pyx_ptype_14softwrap_core2___pyx_scope_struct_5_genexpr = 0; +static PyObject *__pyx_v_14softwrap_core2_not_freed_pointers = 0; +static void *__pyx_f_14softwrap_core2_maelloc(size_t, int); /*proto*/ +static void *__pyx_f_14softwrap_core2_caelloc(size_t, size_t, int); /*proto*/ +static void __pyx_f_14softwrap_core2_fraeee(void *); /*proto*/ +static PyObject *__pyx_f_14softwrap_core2_vec3arr_to_list(vec3 *, int); /*proto*/ +static CYTHON_INLINE unsigned int __pyx_f_14softwrap_core2_xorshift(unsigned int *); /*proto*/ +static CYTHON_INLINE float __pyx_f_14softwrap_core2_uint2neg1pos1f(unsigned int); /*proto*/ +static float __pyx_f_14softwrap_core2_xorshiftf(unsigned int *); /*proto*/ +static PyObject *__pyx_f_14softwrap_core2_index_check(int, int, int __pyx_skip_dispatch); /*proto*/ +static int __Pyx_carray_from_py_float(PyObject *, float *, Py_ssize_t); /*proto*/ +static int __Pyx_carray_from_py_int(PyObject *, int *, Py_ssize_t); /*proto*/ +static CYTHON_INLINE PyObject *__Pyx_carray_to_py_float(float *, Py_ssize_t); /*proto*/ +static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_float(float *, Py_ssize_t); /*proto*/ +#define __Pyx_MODULE_NAME "softwrap_core2" +extern int __pyx_module_is_main_softwrap_core2; +int __pyx_module_is_main_softwrap_core2 = 0; + +/* Implementation of 'softwrap_core2' */ +static PyObject *__pyx_builtin_MemoryError; +static PyObject *__pyx_builtin_print; +static PyObject *__pyx_builtin_hex; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_KeyError; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_builtin_OverflowError; +static const char __pyx_k_i[] = "i"; +static const char __pyx_k_m[] = "m"; +static const char __pyx_k_x[] = "x"; +static const char __pyx_k_y[] = "y"; +static const char __pyx_k_z[] = "z"; +static const char __pyx_k__2[] = "\n -------------------------------------------------------------"; +static const char __pyx_k_gc[] = "gc"; +static const char __pyx_k_BVH[] = "BVH"; +static const char __pyx_k_bvh[] = "bvh"; +static const char __pyx_k_hex[] = "hex"; +static const char __pyx_k_idx[] = "idx"; +static const char __pyx_k_ptr[] = " ptr: "; +static const char __pyx_k_set[] = "set"; +static const char __pyx_k_Mesh[] = "Mesh"; +static const char __pyx_k_args[] = "args"; +static const char __pyx_k_iter[] = "__iter__"; +static const char __pyx_k_line[] = "line"; +static const char __pyx_k_load[] = "load"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_mask[] = "mask"; +static const char __pyx_k_mesh[] = "mesh"; +static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_seed[] = "seed"; +static const char __pyx_k_send[] = "send"; +static const char __pyx_k_size[] = "size"; +static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_type[] = "type"; +static const char __pyx_k_close[] = "close"; +static const char __pyx_k_index[] = "index"; +static const char __pyx_k_items[] = "items"; +static const char __pyx_k_links[] = "links"; +static const char __pyx_k_print[] = "print"; +static const char __pyx_k_ptr_2[] = "ptr"; +static const char __pyx_k_range[] = "range"; +static const char __pyx_k_scale[] = "scale"; +static const char __pyx_k_store[] = "store"; +static const char __pyx_k_throw[] = "throw"; +static const char __pyx_k_value[] = "value"; +static const char __pyx_k_verts[] = "verts"; +static const char __pyx_k_INSIDE[] = "INSIDE"; +static const char __pyx_k_append[] = "append"; +static const char __pyx_k_atexit[] = "atexit"; +static const char __pyx_k_engine[] = "engine"; +static const char __pyx_k_factor[] = "factor"; +static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_invert[] = "invert"; +static const char __pyx_k_reduce[] = "__reduce__"; +static const char __pyx_k_smooth[] = "smooth"; +static const char __pyx_k_OUTSIDE[] = "OUTSIDE"; +static const char __pyx_k_SURFACE[] = "SURFACE"; +static const char __pyx_k_collect[] = "collect"; +static const char __pyx_k_genexpr[] = "genexpr"; +static const char __pyx_k_indexes[] = "indexes"; +static const char __pyx_k_n_rings[] = "n_rings"; +static const char __pyx_k_set_bvh[] = "set_bvh"; +static const char __pyx_k_springs[] = "springs"; +static const char __pyx_k_KeyError[] = "KeyError"; +static const char __pyx_k_getstate[] = "__getstate__"; +static const char __pyx_k_register[] = "register"; +static const char __pyx_k_setstate[] = "__setstate__"; +static const char __pyx_k_LinkProbe[] = "LinkProbe"; +static const char __pyx_k_TypeError[] = "TypeError"; +static const char __pyx_k_core2_pyx[] = ", core2.pyx:"; +static const char __pyx_k_enumerate[] = "enumerate"; +static const char __pyx_k_iter_ring[] = "iter_ring"; +static const char __pyx_k_locations[] = "locations"; +static const char __pyx_k_max_ratio[] = "max_ratio"; +static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; +static const char __pyx_k_set_force[] = "set_force"; +static const char __pyx_k_traceback[] = "traceback"; +static const char __pyx_k_triangles[] = "triangles"; +static const char __pyx_k_IndexError[] = "IndexError"; +static const char __pyx_k_ValueError[] = "ValueError"; +static const char __pyx_k_leak_check[] = "leak_check"; +static const char __pyx_k_max_deform[] = "max_deform"; +static const char __pyx_k_min_deform[] = "min_deform"; +static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; +static const char __pyx_k_MemoryError[] = "MemoryError"; +static const char __pyx_k_SpringLinks[] = "SpringLinks"; +static const char __pyx_k_SymmetryMap[] = "SymmetryMap"; +static const char __pyx_k_create_mask[] = "create_mask"; +static const char __pyx_k_start_index[] = "start_index"; +static const char __pyx_k_RuntimeError[] = "RuntimeError"; +static const char __pyx_k_SpringEngine[] = "SpringEngine"; +static const char __pyx_k_kinetic_step[] = "kinetic_step"; +static const char __pyx_k_masked_store[] = "masked_store"; +static const char __pyx_k_random_verts[] = "random_verts"; +static const char __pyx_k_OverflowError[] = "OverflowError"; +static const char __pyx_k_cycle_quality[] = "cycle_quality"; +static const char __pyx_k_deform_update[] = "deform_update"; +static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_snapping_mode[] = "snapping_mode"; +static const char __pyx_k_core_core2_pyx[] = "core\\core2.pyx"; +static const char __pyx_k_deform_restore[] = "deform_restore"; +static const char __pyx_k_lengths_update[] = "lengths_update"; +static const char __pyx_k_list_too_small[] = "list too small"; +static const char __pyx_k_softwrap_core2[] = "softwrap_core2"; +static const char __pyx_k_SpringEnginePin[] = "SpringEnginePin"; +static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_LinkProbe___iter[] = "LinkProbe.__iter__"; +static const char __pyx_k_No_bvh_avaliable[] = "No bvh avaliable"; +static const char __pyx_k_SpringEngineMask[] = "SpringEngineMask"; +static const char __pyx_k_soft_spring_force[] = "soft_spring_force"; +static const char __pyx_k_MaskContextManager[] = "_MaskContextManager"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_stiff_spring_force[] = "stiff_spring_force"; +static const char __pyx_k_create_spring_group[] = "create_spring_group"; +static const char __pyx_k_create_symmetry_map[] = "create_symmetry_map"; +static const char __pyx_k_invalid_start_index[] = "invalid start_index"; +static const char __pyx_k_update_mesh_normals[] = "update_mesh_normals"; +static const char __pyx_k_create_ternary_links[] = "create_ternary_links"; +static const char __pyx_k_Invalid_or_empty_mesh[] = "Invalid or empty mesh"; +static const char __pyx_k_TernarySmoothingLinks[] = "TernarySmoothingLinks"; +static const char __pyx_k_SpringEnginePin___iter[] = "SpringEnginePin.__iter__"; +static const char __pyx_k_create_quaternary_links[] = "create_quaternary_links"; +static const char __pyx_k_QuaternarySmoothingLinks[] = "QuaternarySmoothingLinks"; +static const char __pyx_k_getitem___locals_genexpr[] = "__getitem__..genexpr"; +static const char __pyx_k_getitem___locals_iter_ring[] = "__getitem__..iter_ring"; +static const char __pyx_k_Oops_Softwrap2_memory_leak_dete[] = "\n ------------ Oops Softwrap2 memory leak detected ------------ \n pointers not freed:"; +static const char __pyx_k_indexes_array_is_not_the_same_si[] = "indexes array is not the same size as locations array"; +static const char __pyx_k_mask_must_have_the_same_number_o[] = "mask must have the same number of elements as engine verts"; +static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; +static const char __pyx_k_self_bvh_closest_indexes_self_pr[] = "self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling"; +static const char __pyx_k_self_centroids_self_face_normals[] = "self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling"; +static const char __pyx_k_vec_data_must_have_the_same_numb[] = "vec_data must have the same number of elements as engine verts times 3"; +static PyObject *__pyx_n_s_BVH; +static PyObject *__pyx_n_u_INSIDE; +static PyObject *__pyx_n_s_IndexError; +static PyObject *__pyx_kp_u_Invalid_or_empty_mesh; +static PyObject *__pyx_n_s_KeyError; +static PyObject *__pyx_n_s_LinkProbe; +static PyObject *__pyx_n_s_LinkProbe___iter; +static PyObject *__pyx_n_s_MaskContextManager; +static PyObject *__pyx_n_s_MemoryError; +static PyObject *__pyx_n_s_Mesh; +static PyObject *__pyx_kp_u_No_bvh_avaliable; +static PyObject *__pyx_n_u_OUTSIDE; +static PyObject *__pyx_kp_u_Oops_Softwrap2_memory_leak_dete; +static PyObject *__pyx_n_s_OverflowError; +static PyObject *__pyx_n_s_QuaternarySmoothingLinks; +static PyObject *__pyx_n_s_RuntimeError; +static PyObject *__pyx_n_u_SURFACE; +static PyObject *__pyx_n_s_SpringEngine; +static PyObject *__pyx_n_s_SpringEngineMask; +static PyObject *__pyx_n_s_SpringEnginePin; +static PyObject *__pyx_n_s_SpringEnginePin___iter; +static PyObject *__pyx_n_s_SpringLinks; +static PyObject *__pyx_n_s_SymmetryMap; +static PyObject *__pyx_n_s_TernarySmoothingLinks; +static PyObject *__pyx_n_s_TypeError; +static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_kp_u__2; +static PyObject *__pyx_n_s_append; +static PyObject *__pyx_n_s_args; +static PyObject *__pyx_n_s_atexit; +static PyObject *__pyx_n_s_bvh; +static PyObject *__pyx_n_s_cline_in_traceback; +static PyObject *__pyx_n_s_close; +static PyObject *__pyx_n_s_collect; +static PyObject *__pyx_kp_u_core2_pyx; +static PyObject *__pyx_kp_s_core_core2_pyx; +static PyObject *__pyx_n_s_create_mask; +static PyObject *__pyx_n_s_create_quaternary_links; +static PyObject *__pyx_n_s_create_spring_group; +static PyObject *__pyx_n_s_create_symmetry_map; +static PyObject *__pyx_n_s_create_ternary_links; +static PyObject *__pyx_n_s_cycle_quality; +static PyObject *__pyx_n_s_deform_restore; +static PyObject *__pyx_n_s_deform_update; +static PyObject *__pyx_n_s_engine; +static PyObject *__pyx_n_s_enumerate; +static PyObject *__pyx_n_s_factor; +static PyObject *__pyx_n_s_gc; +static PyObject *__pyx_n_s_genexpr; +static PyObject *__pyx_n_s_getitem___locals_genexpr; +static PyObject *__pyx_n_s_getitem___locals_iter_ring; +static PyObject *__pyx_n_s_getstate; +static PyObject *__pyx_n_s_hex; +static PyObject *__pyx_n_s_i; +static PyObject *__pyx_n_s_idx; +static PyObject *__pyx_n_s_import; +static PyObject *__pyx_n_s_index; +static PyObject *__pyx_n_s_indexes; +static PyObject *__pyx_kp_u_indexes_array_is_not_the_same_si; +static PyObject *__pyx_kp_u_invalid_start_index; +static PyObject *__pyx_n_s_invert; +static PyObject *__pyx_n_s_items; +static PyObject *__pyx_n_s_iter; +static PyObject *__pyx_n_s_iter_ring; +static PyObject *__pyx_n_s_kinetic_step; +static PyObject *__pyx_n_s_leak_check; +static PyObject *__pyx_n_s_lengths_update; +static PyObject *__pyx_n_s_line; +static PyObject *__pyx_n_s_links; +static PyObject *__pyx_kp_u_list_too_small; +static PyObject *__pyx_n_s_load; +static PyObject *__pyx_n_s_locations; +static PyObject *__pyx_n_s_m; +static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_mask; +static PyObject *__pyx_kp_u_mask_must_have_the_same_number_o; +static PyObject *__pyx_n_s_masked_store; +static PyObject *__pyx_n_s_max_deform; +static PyObject *__pyx_n_s_max_ratio; +static PyObject *__pyx_n_s_mesh; +static PyObject *__pyx_n_s_min_deform; +static PyObject *__pyx_n_s_n_rings; +static PyObject *__pyx_n_s_name; +static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; +static PyObject *__pyx_n_s_print; +static PyObject *__pyx_kp_u_ptr; +static PyObject *__pyx_n_s_ptr_2; +static PyObject *__pyx_n_s_pyx_vtable; +static PyObject *__pyx_n_s_random_verts; +static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_reduce; +static PyObject *__pyx_n_s_reduce_cython; +static PyObject *__pyx_n_s_reduce_ex; +static PyObject *__pyx_n_s_register; +static PyObject *__pyx_n_s_scale; +static PyObject *__pyx_n_s_seed; +static PyObject *__pyx_kp_s_self_bvh_closest_indexes_self_pr; +static PyObject *__pyx_kp_s_self_centroids_self_face_normals; +static PyObject *__pyx_n_s_send; +static PyObject *__pyx_n_s_set; +static PyObject *__pyx_n_s_set_bvh; +static PyObject *__pyx_n_s_set_force; +static PyObject *__pyx_n_s_setstate; +static PyObject *__pyx_n_s_setstate_cython; +static PyObject *__pyx_n_s_size; +static PyObject *__pyx_n_s_smooth; +static PyObject *__pyx_n_s_snapping_mode; +static PyObject *__pyx_n_s_soft_spring_force; +static PyObject *__pyx_n_s_softwrap_core2; +static PyObject *__pyx_n_s_springs; +static PyObject *__pyx_n_s_start_index; +static PyObject *__pyx_n_s_stiff_spring_force; +static PyObject *__pyx_n_s_store; +static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_throw; +static PyObject *__pyx_n_s_traceback; +static PyObject *__pyx_n_s_triangles; +static PyObject *__pyx_n_s_type; +static PyObject *__pyx_n_s_update_mesh_normals; +static PyObject *__pyx_n_s_value; +static PyObject *__pyx_kp_u_vec_data_must_have_the_same_numb; +static PyObject *__pyx_n_s_verts; +static PyObject *__pyx_n_s_x; +static PyObject *__pyx_n_s_y; +static PyObject *__pyx_n_s_z; +static PyObject *__pyx_pf_14softwrap_core2_leak_check(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_2index_check(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_idx, int __pyx_v_size); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_get_vert_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_2get_face_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self); /* proto */ +static int __pyx_pf_14softwrap_core2_4Mesh_4__init__(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, PyObject *__pyx_v_verts, PyObject *__pyx_v_triangles); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_6update_face_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_8update_vert_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_10update_centroids(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_12closest_vert(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, PyObject *__pyx_v_pos); /* proto */ +static void __pyx_pf_14softwrap_core2_4Mesh_14__dealloc__(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_3BVH___cinit__(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_mesh); /* proto */ +static void __pyx_pf_14softwrap_core2_3BVH_2__dealloc__(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_3BVH_4find_nearest(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, PyObject *__pyx_v__p); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_3BVH_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_3BVH_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_9LinkProbe___cinit__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_springs, int __pyx_v_index); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_2__getitem__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self, int __pyx_v_link_index); /* proto */ +static Py_ssize_t __pyx_pf_14softwrap_core2_9LinkProbe_4__len__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_6__iter__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_10avg_radius___get__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_7springs___get__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_5index___get__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_9__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_11__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_11SpringLinks___cinit__(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine, PyObject *__pyx_v_links); /* proto */ +static void __pyx_pf_14softwrap_core2_11SpringLinks_2__dealloc__(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_4__getitem__(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, int __pyx_v_key); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_6lengths_update(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_8smooth(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_10soft_spring_force(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor, float __pyx_v_deform_update, float __pyx_v_deform_restore, float __pyx_v_min_deform, float __pyx_v_max_deform); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_12stiff_spring_force(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_6engine___get__(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_21TernarySmoothingLinks___cinit__(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine, PyObject *__pyx_v_links); /* proto */ +static void __pyx_pf_14softwrap_core2_21TernarySmoothingLinks_2__dealloc__(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_4displacements_update(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_6displacement_force(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, float __pyx_v_factor); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_6engine___get__(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks___cinit__(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine, PyObject *__pyx_v_links); /* proto */ +static void __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_2__dealloc__(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_4lengths_update(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_6smooth(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, float __pyx_v_factor, float __pyx_v_max_ratio); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_6engine___get__(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_7n_links___get__(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_15SpringEnginePin___cinit__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_links, int __pyx_v_start_index, int __pyx_v_n_rings); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_11__getitem___iter_ring(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_2__getitem__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self, int __pyx_v_index); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_4__iter__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_7move(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_scale); /* proto */ +static void __pyx_pf_14softwrap_core2_15SpringEnginePin_9__dealloc__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_6engine___get__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_7n_rings___get__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_11start_index___get__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_11__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_13__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_19_MaskContextManager___cinit__(struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_mask, float __pyx_v_factor, int __pyx_v_invert); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_19_MaskContextManager_2__enter__(struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_19_MaskContextManager_4__exit__(struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_19_MaskContextManager_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_19_MaskContextManager_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_16SpringEngineMask___cinit__(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine, PyObject *__pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_2__getitem__(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_v_index); /* proto */ +static int __pyx_pf_14softwrap_core2_16SpringEngineMask_4__setitem__(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_6set_force(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_8load(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_10store(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_12masked_store(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, float __pyx_v_factor, int __pyx_v_invert); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_14set(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, PyObject *__pyx_v_vec_data); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_16masked_context(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, float __pyx_v_factor, int __pyx_v_invert); /* proto */ +static void __pyx_pf_14softwrap_core2_16SpringEngineMask_18__dealloc__(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_11SymmetryMap___cinit__(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_11__getitem___genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_2__getitem__(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, int __pyx_v_index); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_4mirror(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, int __pyx_v_x, int __pyx_v_y, int __pyx_v_z); /* proto */ +static void __pyx_pf_14softwrap_core2_11SymmetryMap_6__dealloc__(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_5error___get__(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_14softwrap_core2_12SpringEngine___init__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_m, struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_bvh); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_2set_bvh(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_bvh); /* proto */ +static void __pyx_pf_14softwrap_core2_12SpringEngine_4__dealloc__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_14softwrap_core2_12SpringEngine_6__len__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_8__getitem__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, int __pyx_v_key); /* proto */ +static int __pyx_pf_14softwrap_core2_12SpringEngine_10__setitem__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, int __pyx_v_key, float __pyx_v_v); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_12from_list(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_items); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_14set_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_indexes, PyObject *__pyx_v_locations); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_16get_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_indexes); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_18move_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_indexes, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_20snap_to_bvh(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor, int __pyx_v_cycle_quality, PyObject *__pyx_v_snapping_mode); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_22create_spring_group(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_24create_symmetry_map(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_26create_ternary_links(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_28create_quaternary_links(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_30create_mask(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_32random_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor, unsigned int __pyx_v_seed); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_34kinetic_step(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_damping); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_36update_mesh_normals(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_38__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_40__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_14softwrap_core2_Mesh(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2_BVH(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2_LinkProbe(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2_SpringLinks(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2_TernarySmoothingLinks(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2_QuaternarySmoothingLinks(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2_SpringEnginePin(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2__MaskContextManager(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2_SpringEngineMask(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2_SymmetryMap(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2_SpringEngine(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_1___getitem__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_2_iter_ring(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_3___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_4___getitem__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_float_0_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_4; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_tuple__3; +static PyObject *__pyx_tuple__4; +static PyObject *__pyx_tuple__5; +static PyObject *__pyx_tuple__6; +static PyObject *__pyx_tuple__7; +static PyObject *__pyx_tuple__8; +static PyObject *__pyx_tuple__9; +static PyObject *__pyx_tuple__10; +static PyObject *__pyx_tuple__11; +static PyObject *__pyx_tuple__12; +static PyObject *__pyx_tuple__13; +static PyObject *__pyx_tuple__14; +static PyObject *__pyx_tuple__15; +static PyObject *__pyx_tuple__16; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__21; +static PyObject *__pyx_tuple__22; +static PyObject *__pyx_tuple__23; +static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__25; +static PyObject *__pyx_tuple__26; +static PyObject *__pyx_tuple__27; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__29; +static PyObject *__pyx_tuple__30; +static PyObject *__pyx_tuple__31; +static PyObject *__pyx_tuple__32; +static PyObject *__pyx_tuple__33; +static PyObject *__pyx_tuple__34; +static PyObject *__pyx_tuple__35; +static PyObject *__pyx_codeobj__19; +static PyObject *__pyx_codeobj__36; +/* Late includes */ + +/* "core/core2.pyx":265 + * int __LINE__ + * + * cdef void* maelloc(size_t size, int id) except NULL: # <<<<<<<<<<<<<< + * cdef void* ptr = malloc(size) + * if ptr == NULL: + */ + + +# line 265 "core/core2.pyx" +static void *__pyx_f_14softwrap_core2_maelloc(size_t __pyx_v_size, int __pyx_v_id) { + +# line 265 "core/core2.pyx" + void *__pyx_v_ptr; + +# line 265 "core/core2.pyx" + void *__pyx_r; + +# line 265 "core/core2.pyx" + __Pyx_RefNannyDeclarations + +# line 265 "core/core2.pyx" + int __pyx_t_1; + +# line 265 "core/core2.pyx" + PyObject *__pyx_t_2 = NULL; + +# line 265 "core/core2.pyx" + PyObject *__pyx_t_3 = NULL; + +# line 265 "core/core2.pyx" + int __pyx_lineno = 0; + +# line 265 "core/core2.pyx" + const char *__pyx_filename = NULL; + +# line 265 "core/core2.pyx" + int __pyx_clineno = 0; + +# line 265 "core/core2.pyx" + __Pyx_RefNannySetupContext("maelloc", 0); + + /* "core/core2.pyx":266 + * + * cdef void* maelloc(size_t size, int id) except NULL: + * cdef void* ptr = malloc(size) # <<<<<<<<<<<<<< + * if ptr == NULL: + * raise MemoryError + */ + +# line 266 "core/core2.pyx" + __pyx_v_ptr = malloc(__pyx_v_size); + + /* "core/core2.pyx":267 + * cdef void* maelloc(size_t size, int id) except NULL: + * cdef void* ptr = malloc(size) + * if ptr == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * not_freed_pointers[ptr] = id + */ + +# line 267 "core/core2.pyx" + __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0); + +# line 267 "core/core2.pyx" + if (unlikely(__pyx_t_1)) { + + /* "core/core2.pyx":268 + * cdef void* ptr = malloc(size) + * if ptr == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * not_freed_pointers[ptr] = id + * return ptr + */ + +# line 268 "core/core2.pyx" + PyErr_NoMemory(); __PYX_ERR(0, 268, __pyx_L1_error) + + /* "core/core2.pyx":267 + * cdef void* maelloc(size_t size, int id) except NULL: + * cdef void* ptr = malloc(size) + * if ptr == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * not_freed_pointers[ptr] = id + */ + +# line 267 "core/core2.pyx" + } + + /* "core/core2.pyx":269 + * if ptr == NULL: + * raise MemoryError + * not_freed_pointers[ptr] = id # <<<<<<<<<<<<<< + * return ptr + * + */ + +# line 269 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error) + +# line 269 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 269 "core/core2.pyx" + if (unlikely(__pyx_v_14softwrap_core2_not_freed_pointers == Py_None)) { + +# line 269 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 269 "core/core2.pyx" + __PYX_ERR(0, 269, __pyx_L1_error) + +# line 269 "core/core2.pyx" + } + +# line 269 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_ptr)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) + +# line 269 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 269 "core/core2.pyx" + if (unlikely(PyDict_SetItem(__pyx_v_14softwrap_core2_not_freed_pointers, __pyx_t_3, __pyx_t_2) < 0)) __PYX_ERR(0, 269, __pyx_L1_error) + +# line 269 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 269 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "core/core2.pyx":270 + * raise MemoryError + * not_freed_pointers[ptr] = id + * return ptr # <<<<<<<<<<<<<< + * + * cdef void* caelloc(size_t n, size_t size, int id) except NULL: + */ + +# line 270 "core/core2.pyx" + __pyx_r = __pyx_v_ptr; + +# line 270 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":265 + * int __LINE__ + * + * cdef void* maelloc(size_t size, int id) except NULL: # <<<<<<<<<<<<<< + * cdef void* ptr = malloc(size) + * if ptr == NULL: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("softwrap_core2.maelloc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":272 + * return ptr + * + * cdef void* caelloc(size_t n, size_t size, int id) except NULL: # <<<<<<<<<<<<<< + * cdef void* ptr = calloc(n, size) + * if ptr == NULL: + */ + + +# line 272 "core/core2.pyx" +static void *__pyx_f_14softwrap_core2_caelloc(size_t __pyx_v_n, size_t __pyx_v_size, int __pyx_v_id) { + +# line 272 "core/core2.pyx" + void *__pyx_v_ptr; + +# line 272 "core/core2.pyx" + void *__pyx_r; + +# line 272 "core/core2.pyx" + __Pyx_RefNannyDeclarations + +# line 272 "core/core2.pyx" + int __pyx_t_1; + +# line 272 "core/core2.pyx" + PyObject *__pyx_t_2 = NULL; + +# line 272 "core/core2.pyx" + PyObject *__pyx_t_3 = NULL; + +# line 272 "core/core2.pyx" + int __pyx_lineno = 0; + +# line 272 "core/core2.pyx" + const char *__pyx_filename = NULL; + +# line 272 "core/core2.pyx" + int __pyx_clineno = 0; + +# line 272 "core/core2.pyx" + __Pyx_RefNannySetupContext("caelloc", 0); + + /* "core/core2.pyx":273 + * + * cdef void* caelloc(size_t n, size_t size, int id) except NULL: + * cdef void* ptr = calloc(n, size) # <<<<<<<<<<<<<< + * if ptr == NULL: + * raise MemoryError + */ + +# line 273 "core/core2.pyx" + __pyx_v_ptr = calloc(__pyx_v_n, __pyx_v_size); + + /* "core/core2.pyx":274 + * cdef void* caelloc(size_t n, size_t size, int id) except NULL: + * cdef void* ptr = calloc(n, size) + * if ptr == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * not_freed_pointers[ptr] = id + */ + +# line 274 "core/core2.pyx" + __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0); + +# line 274 "core/core2.pyx" + if (unlikely(__pyx_t_1)) { + + /* "core/core2.pyx":275 + * cdef void* ptr = calloc(n, size) + * if ptr == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * not_freed_pointers[ptr] = id + * return ptr + */ + +# line 275 "core/core2.pyx" + PyErr_NoMemory(); __PYX_ERR(0, 275, __pyx_L1_error) + + /* "core/core2.pyx":274 + * cdef void* caelloc(size_t n, size_t size, int id) except NULL: + * cdef void* ptr = calloc(n, size) + * if ptr == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * not_freed_pointers[ptr] = id + */ + +# line 274 "core/core2.pyx" + } + + /* "core/core2.pyx":276 + * if ptr == NULL: + * raise MemoryError + * not_freed_pointers[ptr] = id # <<<<<<<<<<<<<< + * return ptr + * + */ + +# line 276 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error) + +# line 276 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 276 "core/core2.pyx" + if (unlikely(__pyx_v_14softwrap_core2_not_freed_pointers == Py_None)) { + +# line 276 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 276 "core/core2.pyx" + __PYX_ERR(0, 276, __pyx_L1_error) + +# line 276 "core/core2.pyx" + } + +# line 276 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_ptr)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error) + +# line 276 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 276 "core/core2.pyx" + if (unlikely(PyDict_SetItem(__pyx_v_14softwrap_core2_not_freed_pointers, __pyx_t_3, __pyx_t_2) < 0)) __PYX_ERR(0, 276, __pyx_L1_error) + +# line 276 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 276 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "core/core2.pyx":277 + * raise MemoryError + * not_freed_pointers[ptr] = id + * return ptr # <<<<<<<<<<<<<< + * + * cdef void fraeee(void* ptr): + */ + +# line 277 "core/core2.pyx" + __pyx_r = __pyx_v_ptr; + +# line 277 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":272 + * return ptr + * + * cdef void* caelloc(size_t n, size_t size, int id) except NULL: # <<<<<<<<<<<<<< + * cdef void* ptr = calloc(n, size) + * if ptr == NULL: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("softwrap_core2.caelloc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":279 + * return ptr + * + * cdef void fraeee(void* ptr): # <<<<<<<<<<<<<< + * if ptr is not NULL: + * del not_freed_pointers[ ptr] + */ + + +# line 279 "core/core2.pyx" +static void __pyx_f_14softwrap_core2_fraeee(void *__pyx_v_ptr) { + +# line 279 "core/core2.pyx" + __Pyx_RefNannyDeclarations + +# line 279 "core/core2.pyx" + int __pyx_t_1; + +# line 279 "core/core2.pyx" + PyObject *__pyx_t_2 = NULL; + +# line 279 "core/core2.pyx" + int __pyx_lineno = 0; + +# line 279 "core/core2.pyx" + const char *__pyx_filename = NULL; + +# line 279 "core/core2.pyx" + int __pyx_clineno = 0; + +# line 279 "core/core2.pyx" + __Pyx_RefNannySetupContext("fraeee", 0); + + /* "core/core2.pyx":280 + * + * cdef void fraeee(void* ptr): + * if ptr is not NULL: # <<<<<<<<<<<<<< + * del not_freed_pointers[ ptr] + * free(ptr) + */ + +# line 280 "core/core2.pyx" + __pyx_t_1 = ((__pyx_v_ptr != NULL) != 0); + +# line 280 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":281 + * cdef void fraeee(void* ptr): + * if ptr is not NULL: + * del not_freed_pointers[ ptr] # <<<<<<<<<<<<<< + * free(ptr) + * + */ + +# line 281 "core/core2.pyx" + if (unlikely(__pyx_v_14softwrap_core2_not_freed_pointers == Py_None)) { + +# line 281 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 281 "core/core2.pyx" + __PYX_ERR(0, 281, __pyx_L1_error) + +# line 281 "core/core2.pyx" + } + +# line 281 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_ptr)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error) + +# line 281 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 281 "core/core2.pyx" + if (unlikely(PyDict_DelItem(__pyx_v_14softwrap_core2_not_freed_pointers, __pyx_t_2) < 0)) __PYX_ERR(0, 281, __pyx_L1_error) + +# line 281 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "core/core2.pyx":280 + * + * cdef void fraeee(void* ptr): + * if ptr is not NULL: # <<<<<<<<<<<<<< + * del not_freed_pointers[ ptr] + * free(ptr) + */ + +# line 280 "core/core2.pyx" + } + + /* "core/core2.pyx":282 + * if ptr is not NULL: + * del not_freed_pointers[ ptr] + * free(ptr) # <<<<<<<<<<<<<< + * + * + */ + +# line 282 "core/core2.pyx" + free(__pyx_v_ptr); + + /* "core/core2.pyx":279 + * return ptr + * + * cdef void fraeee(void* ptr): # <<<<<<<<<<<<<< + * if ptr is not NULL: + * del not_freed_pointers[ ptr] + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("softwrap_core2.fraeee", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "core/core2.pyx":285 + * + * + * def leak_check(): # <<<<<<<<<<<<<< + * import gc + * gc.collect() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_1leak_check(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_14softwrap_core2_1leak_check = {"leak_check", (PyCFunction)__pyx_pw_14softwrap_core2_1leak_check, METH_NOARGS, 0}; +static PyObject *__pyx_pw_14softwrap_core2_1leak_check(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("leak_check (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_leak_check(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_leak_check(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_v_gc = NULL; + PyObject *__pyx_v_ptr = NULL; + PyObject *__pyx_v_line = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("leak_check", 0); + + /* "core/core2.pyx":286 + * + * def leak_check(): + * import gc # <<<<<<<<<<<<<< + * gc.collect() + * + */ + +# line 286 "core/core2.pyx" + __pyx_t_1 = __Pyx_Import(__pyx_n_s_gc, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error) + +# line 286 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 286 "core/core2.pyx" + __pyx_v_gc = __pyx_t_1; + +# line 286 "core/core2.pyx" + __pyx_t_1 = 0; + + /* "core/core2.pyx":287 + * def leak_check(): + * import gc + * gc.collect() # <<<<<<<<<<<<<< + * + * if not_freed_pointers: + */ + +# line 287 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_gc, __pyx_n_s_collect); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error) + +# line 287 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 287 "core/core2.pyx" + __pyx_t_3 = NULL; + +# line 287 "core/core2.pyx" + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + +# line 287 "core/core2.pyx" + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + +# line 287 "core/core2.pyx" + if (likely(__pyx_t_3)) { + +# line 287 "core/core2.pyx" + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + +# line 287 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_3); + +# line 287 "core/core2.pyx" + __Pyx_INCREF(function); + +# line 287 "core/core2.pyx" + __Pyx_DECREF_SET(__pyx_t_2, function); + +# line 287 "core/core2.pyx" + } + +# line 287 "core/core2.pyx" + } + +# line 287 "core/core2.pyx" + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + +# line 287 "core/core2.pyx" + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 287 "core/core2.pyx" + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + +# line 287 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 287 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +# line 287 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "core/core2.pyx":289 + * gc.collect() + * + * if not_freed_pointers: # <<<<<<<<<<<<<< + * print('\n ------------ Oops Softwrap2 memory leak detected ------------ \n pointers not freed:') + * for ptr, line in not_freed_pointers.items(): + */ + +# line 289 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_14softwrap_core2_not_freed_pointers); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 289, __pyx_L1_error) + +# line 289 "core/core2.pyx" + if (__pyx_t_4) { + + /* "core/core2.pyx":290 + * + * if not_freed_pointers: + * print('\n ------------ Oops Softwrap2 memory leak detected ------------ \n pointers not freed:') # <<<<<<<<<<<<<< + * for ptr, line in not_freed_pointers.items(): + * print(f' ptr: {hex(ptr)}, core2.pyx:{line}') + */ + +# line 290 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) + +# line 290 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 290 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "core/core2.pyx":291 + * if not_freed_pointers: + * print('\n ------------ Oops Softwrap2 memory leak detected ------------ \n pointers not freed:') + * for ptr, line in not_freed_pointers.items(): # <<<<<<<<<<<<<< + * print(f' ptr: {hex(ptr)}, core2.pyx:{line}') + * print('\n -------------------------------------------------------------') + */ + +# line 291 "core/core2.pyx" + __pyx_t_5 = 0; + +# line 291 "core/core2.pyx" + if (unlikely(__pyx_v_14softwrap_core2_not_freed_pointers == Py_None)) { + +# line 291 "core/core2.pyx" + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); + +# line 291 "core/core2.pyx" + __PYX_ERR(0, 291, __pyx_L1_error) + +# line 291 "core/core2.pyx" + } + +# line 291 "core/core2.pyx" + __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_14softwrap_core2_not_freed_pointers, 1, __pyx_n_s_items, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) + +# line 291 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 291 "core/core2.pyx" + __Pyx_XDECREF(__pyx_t_1); + +# line 291 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 291 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 291 "core/core2.pyx" + while (1) { + +# line 291 "core/core2.pyx" + __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_6, &__pyx_t_5, &__pyx_t_2, &__pyx_t_3, NULL, __pyx_t_7); + +# line 291 "core/core2.pyx" + if (unlikely(__pyx_t_8 == 0)) break; + +# line 291 "core/core2.pyx" + if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 291, __pyx_L1_error) + +# line 291 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 291 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 291 "core/core2.pyx" + __Pyx_XDECREF_SET(__pyx_v_ptr, __pyx_t_2); + +# line 291 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 291 "core/core2.pyx" + __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_3); + +# line 291 "core/core2.pyx" + __pyx_t_3 = 0; + + /* "core/core2.pyx":292 + * print('\n ------------ Oops Softwrap2 memory leak detected ------------ \n pointers not freed:') + * for ptr, line in not_freed_pointers.items(): + * print(f' ptr: {hex(ptr)}, core2.pyx:{line}') # <<<<<<<<<<<<<< + * print('\n -------------------------------------------------------------') + * + */ + +# line 292 "core/core2.pyx" + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) + +# line 292 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 292 "core/core2.pyx" + __pyx_t_9 = 0; + +# line 292 "core/core2.pyx" + __pyx_t_10 = 127; + +# line 292 "core/core2.pyx" + __Pyx_INCREF(__pyx_kp_u_ptr); + +# line 292 "core/core2.pyx" + __pyx_t_9 += 9; + +# line 292 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_kp_u_ptr); + +# line 292 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_ptr); + +# line 292 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_v_ptr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) + +# line 292 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 292 "core/core2.pyx" + __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 292, __pyx_L1_error) + +# line 292 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_11); + +# line 292 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +# line 292 "core/core2.pyx" + __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) : __pyx_t_10; + +# line 292 "core/core2.pyx" + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11); + +# line 292 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_11); + +# line 292 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_11); + +# line 292 "core/core2.pyx" + __pyx_t_11 = 0; + +# line 292 "core/core2.pyx" + __Pyx_INCREF(__pyx_kp_u_core2_pyx); + +# line 292 "core/core2.pyx" + __pyx_t_9 += 12; + +# line 292 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_kp_u_core2_pyx); + +# line 292 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_core2_pyx); + +# line 292 "core/core2.pyx" + __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_v_line, __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 292, __pyx_L1_error) + +# line 292 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_11); + +# line 292 "core/core2.pyx" + __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) : __pyx_t_10; + +# line 292 "core/core2.pyx" + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11); + +# line 292 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_11); + +# line 292 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_11); + +# line 292 "core/core2.pyx" + __pyx_t_11 = 0; + +# line 292 "core/core2.pyx" + __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 292, __pyx_L1_error) + +# line 292 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_11); + +# line 292 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 292 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) + +# line 292 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 292 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + +# line 292 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 292 "core/core2.pyx" + } + +# line 292 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "core/core2.pyx":293 + * for ptr, line in not_freed_pointers.items(): + * print(f' ptr: {hex(ptr)}, core2.pyx:{line}') + * print('\n -------------------------------------------------------------') # <<<<<<<<<<<<<< + * + * + */ + +# line 293 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) + +# line 293 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 293 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "core/core2.pyx":289 + * gc.collect() + * + * if not_freed_pointers: # <<<<<<<<<<<<<< + * print('\n ------------ Oops Softwrap2 memory leak detected ------------ \n pointers not freed:') + * for ptr, line in not_freed_pointers.items(): + */ + +# line 289 "core/core2.pyx" + } + + /* "core/core2.pyx":285 + * + * + * def leak_check(): # <<<<<<<<<<<<<< + * import gc + * gc.collect() + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("softwrap_core2.leak_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_gc); + __Pyx_XDECREF(__pyx_v_ptr); + __Pyx_XDECREF(__pyx_v_line); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":299 + * + * + * cdef list vec3arr_to_list(vec3* arr, int size): # <<<<<<<<<<<<<< + * cdef list l = [None] * size + * cdef int i + */ + + +# line 299 "core/core2.pyx" +static PyObject *__pyx_f_14softwrap_core2_vec3arr_to_list(vec3 *__pyx_v_arr, int __pyx_v_size) { + +# line 299 "core/core2.pyx" + PyObject *__pyx_v_l = 0; + +# line 299 "core/core2.pyx" + int __pyx_v_i; + +# line 299 "core/core2.pyx" + PyObject *__pyx_r = NULL; + +# line 299 "core/core2.pyx" + __Pyx_RefNannyDeclarations + +# line 299 "core/core2.pyx" + PyObject *__pyx_t_1 = NULL; + +# line 299 "core/core2.pyx" + int __pyx_t_2; + +# line 299 "core/core2.pyx" + int __pyx_t_3; + +# line 299 "core/core2.pyx" + int __pyx_t_4; + +# line 299 "core/core2.pyx" + PyObject *__pyx_t_5 = NULL; + +# line 299 "core/core2.pyx" + PyObject *__pyx_t_6 = NULL; + +# line 299 "core/core2.pyx" + PyObject *__pyx_t_7 = NULL; + +# line 299 "core/core2.pyx" + int __pyx_lineno = 0; + +# line 299 "core/core2.pyx" + const char *__pyx_filename = NULL; + +# line 299 "core/core2.pyx" + int __pyx_clineno = 0; + +# line 299 "core/core2.pyx" + __Pyx_RefNannySetupContext("vec3arr_to_list", 0); + + /* "core/core2.pyx":300 + * + * cdef list vec3arr_to_list(vec3* arr, int size): + * cdef list l = [None] * size # <<<<<<<<<<<<<< + * cdef int i + * for i in range(size): + */ + +# line 300 "core/core2.pyx" + __pyx_t_1 = PyList_New(1 * ((__pyx_v_size<0) ? 0:__pyx_v_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) + +# line 300 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 300 "core/core2.pyx" + { Py_ssize_t __pyx_temp; + +# line 300 "core/core2.pyx" + for (__pyx_temp=0; __pyx_temp < __pyx_v_size; __pyx_temp++) { + +# line 300 "core/core2.pyx" + __Pyx_INCREF(Py_None); + +# line 300 "core/core2.pyx" + __Pyx_GIVEREF(Py_None); + +# line 300 "core/core2.pyx" + PyList_SET_ITEM(__pyx_t_1, __pyx_temp, Py_None); + +# line 300 "core/core2.pyx" + } + +# line 300 "core/core2.pyx" + } + +# line 300 "core/core2.pyx" + __pyx_v_l = ((PyObject*)__pyx_t_1); + +# line 300 "core/core2.pyx" + __pyx_t_1 = 0; + + /* "core/core2.pyx":302 + * cdef list l = [None] * size + * cdef int i + * for i in range(size): # <<<<<<<<<<<<<< + * l[i] = (arr[i].v[0], arr[i].v[1], arr[i].v[2]) + * + */ + +# line 302 "core/core2.pyx" + __pyx_t_2 = __pyx_v_size; + +# line 302 "core/core2.pyx" + __pyx_t_3 = __pyx_t_2; + +# line 302 "core/core2.pyx" + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + +# line 302 "core/core2.pyx" + __pyx_v_i = __pyx_t_4; + + /* "core/core2.pyx":303 + * cdef int i + * for i in range(size): + * l[i] = (arr[i].v[0], arr[i].v[1], arr[i].v[2]) # <<<<<<<<<<<<<< + * + * return l + */ + +# line 303 "core/core2.pyx" + __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_arr[__pyx_v_i]).v[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error) + +# line 303 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 303 "core/core2.pyx" + __pyx_t_5 = PyFloat_FromDouble(((__pyx_v_arr[__pyx_v_i]).v[1])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 303, __pyx_L1_error) + +# line 303 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_5); + +# line 303 "core/core2.pyx" + __pyx_t_6 = PyFloat_FromDouble(((__pyx_v_arr[__pyx_v_i]).v[2])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L1_error) + +# line 303 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_6); + +# line 303 "core/core2.pyx" + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 303, __pyx_L1_error) + +# line 303 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 303 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_1); + +# line 303 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); + +# line 303 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_5); + +# line 303 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); + +# line 303 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_6); + +# line 303 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6); + +# line 303 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 303 "core/core2.pyx" + __pyx_t_5 = 0; + +# line 303 "core/core2.pyx" + __pyx_t_6 = 0; + +# line 303 "core/core2.pyx" + if (unlikely(__Pyx_SetItemInt(__pyx_v_l, __pyx_v_i, __pyx_t_7, int, 1, __Pyx_PyInt_From_int, 1, 1, 0) < 0)) __PYX_ERR(0, 303, __pyx_L1_error) + +# line 303 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 303 "core/core2.pyx" + } + + /* "core/core2.pyx":305 + * l[i] = (arr[i].v[0], arr[i].v[1], arr[i].v[2]) + * + * return l # <<<<<<<<<<<<<< + * + * + */ + +# line 305 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 305 "core/core2.pyx" + __Pyx_INCREF(__pyx_v_l); + +# line 305 "core/core2.pyx" + __pyx_r = __pyx_v_l; + +# line 305 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":299 + * + * + * cdef list vec3arr_to_list(vec3* arr, int size): # <<<<<<<<<<<<<< + * cdef list l = [None] * size + * cdef int i + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("softwrap_core2.vec3arr_to_list", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_l); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":308 + * + * + * cdef inline unsigned int xorshift(unsigned int* seed) nogil: # <<<<<<<<<<<<<< + * seed[0] ^= seed[0] << 11 + * seed[0] ^= seed[0] >> 17 + */ + + +# line 308 "core/core2.pyx" +static CYTHON_INLINE unsigned int __pyx_f_14softwrap_core2_xorshift(unsigned int *__pyx_v_seed) { + +# line 308 "core/core2.pyx" + unsigned int __pyx_r; + +# line 308 "core/core2.pyx" + long __pyx_t_1; + + /* "core/core2.pyx":309 + * + * cdef inline unsigned int xorshift(unsigned int* seed) nogil: + * seed[0] ^= seed[0] << 11 # <<<<<<<<<<<<<< + * seed[0] ^= seed[0] >> 17 + * seed[0] ^= seed[0] << 9 + */ + +# line 309 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 309 "core/core2.pyx" + (__pyx_v_seed[__pyx_t_1]) = ((__pyx_v_seed[__pyx_t_1]) ^ ((__pyx_v_seed[0]) << 11)); + + /* "core/core2.pyx":310 + * cdef inline unsigned int xorshift(unsigned int* seed) nogil: + * seed[0] ^= seed[0] << 11 + * seed[0] ^= seed[0] >> 17 # <<<<<<<<<<<<<< + * seed[0] ^= seed[0] << 9 + * return seed[0] + */ + +# line 310 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 310 "core/core2.pyx" + (__pyx_v_seed[__pyx_t_1]) = ((__pyx_v_seed[__pyx_t_1]) ^ ((__pyx_v_seed[0]) >> 17)); + + /* "core/core2.pyx":311 + * seed[0] ^= seed[0] << 11 + * seed[0] ^= seed[0] >> 17 + * seed[0] ^= seed[0] << 9 # <<<<<<<<<<<<<< + * return seed[0] + * + */ + +# line 311 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 311 "core/core2.pyx" + (__pyx_v_seed[__pyx_t_1]) = ((__pyx_v_seed[__pyx_t_1]) ^ ((__pyx_v_seed[0]) << 9)); + + /* "core/core2.pyx":312 + * seed[0] ^= seed[0] >> 17 + * seed[0] ^= seed[0] << 9 + * return seed[0] # <<<<<<<<<<<<<< + * + * cdef inline float uint2neg1pos1f(unsigned int v) nogil: + */ + +# line 312 "core/core2.pyx" + __pyx_r = (__pyx_v_seed[0]); + +# line 312 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":308 + * + * + * cdef inline unsigned int xorshift(unsigned int* seed) nogil: # <<<<<<<<<<<<<< + * seed[0] ^= seed[0] << 11 + * seed[0] ^= seed[0] >> 17 + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "core/core2.pyx":314 + * return seed[0] + * + * cdef inline float uint2neg1pos1f(unsigned int v) nogil: # <<<<<<<<<<<<<< + * return v / ( 0xffffffff >> 1) - 1.0 + * + */ + + +# line 314 "core/core2.pyx" +static CYTHON_INLINE float __pyx_f_14softwrap_core2_uint2neg1pos1f(unsigned int __pyx_v_v) { + +# line 314 "core/core2.pyx" + float __pyx_r; + + /* "core/core2.pyx":315 + * + * cdef inline float uint2neg1pos1f(unsigned int v) nogil: + * return v / ( 0xffffffff >> 1) - 1.0 # <<<<<<<<<<<<<< + * + * cdef float xorshiftf(unsigned int* seed) nogil: + */ + +# line 315 "core/core2.pyx" + __pyx_r = ((((float)__pyx_v_v) / ((float)(((unsigned int)0xffffffff) >> 1))) - ((float)1.0)); + +# line 315 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":314 + * return seed[0] + * + * cdef inline float uint2neg1pos1f(unsigned int v) nogil: # <<<<<<<<<<<<<< + * return v / ( 0xffffffff >> 1) - 1.0 + * + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "core/core2.pyx":317 + * return v / ( 0xffffffff >> 1) - 1.0 + * + * cdef float xorshiftf(unsigned int* seed) nogil: # <<<<<<<<<<<<<< + * return uint2neg1pos1f(xorshift(seed)) + * + */ + + +# line 317 "core/core2.pyx" +static float __pyx_f_14softwrap_core2_xorshiftf(unsigned int *__pyx_v_seed) { + +# line 317 "core/core2.pyx" + float __pyx_r; + + /* "core/core2.pyx":318 + * + * cdef float xorshiftf(unsigned int* seed) nogil: + * return uint2neg1pos1f(xorshift(seed)) # <<<<<<<<<<<<<< + * + * + */ + +# line 318 "core/core2.pyx" + __pyx_r = __pyx_f_14softwrap_core2_uint2neg1pos1f(__pyx_f_14softwrap_core2_xorshift(__pyx_v_seed)); + +# line 318 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":317 + * return v / ( 0xffffffff >> 1) - 1.0 + * + * cdef float xorshiftf(unsigned int* seed) nogil: # <<<<<<<<<<<<<< + * return uint2neg1pos1f(xorshift(seed)) + * + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "core/core2.pyx":321 + * + * + * cpdef index_check(int idx, int size): # <<<<<<<<<<<<<< + * if idx < 0 or idx >= size: + * raise IndexError(idx) + */ + +static PyObject *__pyx_pw_14softwrap_core2_3index_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_14softwrap_core2_index_check(int __pyx_v_idx, int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("index_check", 0); + + /* "core/core2.pyx":322 + * + * cpdef index_check(int idx, int size): + * if idx < 0 or idx >= size: # <<<<<<<<<<<<<< + * raise IndexError(idx) + * + */ + +# line 322 "core/core2.pyx" + __pyx_t_2 = ((__pyx_v_idx < 0) != 0); + +# line 322 "core/core2.pyx" + if (!__pyx_t_2) { + +# line 322 "core/core2.pyx" + } else { + +# line 322 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 322 "core/core2.pyx" + goto __pyx_L4_bool_binop_done; + +# line 322 "core/core2.pyx" + } + +# line 322 "core/core2.pyx" + __pyx_t_2 = ((__pyx_v_idx >= __pyx_v_size) != 0); + +# line 322 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 322 "core/core2.pyx" + __pyx_L4_bool_binop_done:; + +# line 322 "core/core2.pyx" + if (unlikely(__pyx_t_1)) { + + /* "core/core2.pyx":323 + * cpdef index_check(int idx, int size): + * if idx < 0 or idx >= size: + * raise IndexError(idx) # <<<<<<<<<<<<<< + * + * @cython.final + */ + +# line 323 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error) + +# line 323 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 323 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 323, __pyx_L1_error) + +# line 323 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 323 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 323 "core/core2.pyx" + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + +# line 323 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 323 "core/core2.pyx" + __PYX_ERR(0, 323, __pyx_L1_error) + + /* "core/core2.pyx":322 + * + * cpdef index_check(int idx, int size): + * if idx < 0 or idx >= size: # <<<<<<<<<<<<<< + * raise IndexError(idx) + * + */ + +# line 322 "core/core2.pyx" + } + + /* "core/core2.pyx":321 + * + * + * cpdef index_check(int idx, int size): # <<<<<<<<<<<<<< + * if idx < 0 or idx >= size: + * raise IndexError(idx) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.index_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_3index_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_3index_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_idx; + int __pyx_v_size; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("index_check (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_size,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("index_check", 1, 2, 2, 1); __PYX_ERR(0, 321, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "index_check") < 0)) __PYX_ERR(0, 321, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_idx = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + __pyx_v_size = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("index_check", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 321, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.index_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_2index_check(__pyx_self, __pyx_v_idx, __pyx_v_size); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_2index_check(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_idx, int __pyx_v_size) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("index_check", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_14softwrap_core2_index_check(__pyx_v_idx, __pyx_v_size, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.index_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":336 + * int n_triangles + * + * def get_vert_normals(self): # <<<<<<<<<<<<<< + * return vec3arr_to_list(self.vert_normals, self.n_verts) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_1get_vert_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_1get_vert_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_vert_normals (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_4Mesh_get_vert_normals(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_get_vert_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_vert_normals", 0); + + /* "core/core2.pyx":337 + * + * def get_vert_normals(self): + * return vec3arr_to_list(self.vert_normals, self.n_verts) # <<<<<<<<<<<<<< + * + * def get_face_normals(self): + */ + +# line 337 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 337 "core/core2.pyx" + __pyx_t_1 = __pyx_f_14softwrap_core2_vec3arr_to_list(__pyx_v_self->vert_normals, __pyx_v_self->n_verts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error) + +# line 337 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 337 "core/core2.pyx" + __pyx_r = __pyx_t_1; + +# line 337 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 337 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":336 + * int n_triangles + * + * def get_vert_normals(self): # <<<<<<<<<<<<<< + * return vec3arr_to_list(self.vert_normals, self.n_verts) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.Mesh.get_vert_normals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":339 + * return vec3arr_to_list(self.vert_normals, self.n_verts) + * + * def get_face_normals(self): # <<<<<<<<<<<<<< + * return vec3arr_to_list(self.face_normals, self.n_triangles) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_3get_face_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_3get_face_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_face_normals (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_4Mesh_2get_face_normals(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_2get_face_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_face_normals", 0); + + /* "core/core2.pyx":340 + * + * def get_face_normals(self): + * return vec3arr_to_list(self.face_normals, self.n_triangles) # <<<<<<<<<<<<<< + * + * def __init__(self, verts, triangles): + */ + +# line 340 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 340 "core/core2.pyx" + __pyx_t_1 = __pyx_f_14softwrap_core2_vec3arr_to_list(__pyx_v_self->face_normals, __pyx_v_self->n_triangles); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) + +# line 340 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 340 "core/core2.pyx" + __pyx_r = __pyx_t_1; + +# line 340 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 340 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":339 + * return vec3arr_to_list(self.vert_normals, self.n_verts) + * + * def get_face_normals(self): # <<<<<<<<<<<<<< + * return vec3arr_to_list(self.face_normals, self.n_triangles) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.Mesh.get_face_normals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":342 + * return vec3arr_to_list(self.face_normals, self.n_triangles) + * + * def __init__(self, verts, triangles): # <<<<<<<<<<<<<< + * self.n_verts = len(verts) + * self.n_triangles = len(triangles) + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_4Mesh_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_4Mesh_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_verts = 0; + PyObject *__pyx_v_triangles = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_verts,&__pyx_n_s_triangles,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verts)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_triangles)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 342, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 342, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_verts = values[0]; + __pyx_v_triangles = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 342, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.Mesh.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_4Mesh_4__init__(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self), __pyx_v_verts, __pyx_v_triangles); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_4Mesh_4__init__(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, PyObject *__pyx_v_verts, PyObject *__pyx_v_triangles) { + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + void *__pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + float __pyx_t_9[3]; + int __pyx_t_10[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "core/core2.pyx":343 + * + * def __init__(self, verts, triangles): + * self.n_verts = len(verts) # <<<<<<<<<<<<<< + * self.n_triangles = len(triangles) + * + */ + +# line 343 "core/core2.pyx" + __pyx_t_1 = PyObject_Length(__pyx_v_verts); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 343, __pyx_L1_error) + +# line 343 "core/core2.pyx" + __pyx_v_self->n_verts = __pyx_t_1; + + /* "core/core2.pyx":344 + * def __init__(self, verts, triangles): + * self.n_verts = len(verts) + * self.n_triangles = len(triangles) # <<<<<<<<<<<<<< + * + * if len(verts) < 3 or len(triangles) < 1: + */ + +# line 344 "core/core2.pyx" + __pyx_t_1 = PyObject_Length(__pyx_v_triangles); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 344, __pyx_L1_error) + +# line 344 "core/core2.pyx" + __pyx_v_self->n_triangles = __pyx_t_1; + + /* "core/core2.pyx":346 + * self.n_triangles = len(triangles) + * + * if len(verts) < 3 or len(triangles) < 1: # <<<<<<<<<<<<<< + * raise ValueError('Invalid or empty mesh') + * + */ + +# line 346 "core/core2.pyx" + __pyx_t_1 = PyObject_Length(__pyx_v_verts); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 346, __pyx_L1_error) + +# line 346 "core/core2.pyx" + __pyx_t_3 = ((__pyx_t_1 < 3) != 0); + +# line 346 "core/core2.pyx" + if (!__pyx_t_3) { + +# line 346 "core/core2.pyx" + } else { + +# line 346 "core/core2.pyx" + __pyx_t_2 = __pyx_t_3; + +# line 346 "core/core2.pyx" + goto __pyx_L4_bool_binop_done; + +# line 346 "core/core2.pyx" + } + +# line 346 "core/core2.pyx" + __pyx_t_1 = PyObject_Length(__pyx_v_triangles); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 346, __pyx_L1_error) + +# line 346 "core/core2.pyx" + __pyx_t_3 = ((__pyx_t_1 < 1) != 0); + +# line 346 "core/core2.pyx" + __pyx_t_2 = __pyx_t_3; + +# line 346 "core/core2.pyx" + __pyx_L4_bool_binop_done:; + +# line 346 "core/core2.pyx" + if (unlikely(__pyx_t_2)) { + + /* "core/core2.pyx":347 + * + * if len(verts) < 3 or len(triangles) < 1: + * raise ValueError('Invalid or empty mesh') # <<<<<<<<<<<<<< + * + * self.verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + */ + +# line 347 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error) + +# line 347 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 347 "core/core2.pyx" + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + +# line 347 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 347 "core/core2.pyx" + __PYX_ERR(0, 347, __pyx_L1_error) + + /* "core/core2.pyx":346 + * self.n_triangles = len(triangles) + * + * if len(verts) < 3 or len(triangles) < 1: # <<<<<<<<<<<<<< + * raise ValueError('Invalid or empty mesh') + * + */ + +# line 346 "core/core2.pyx" + } + + /* "core/core2.pyx":349 + * raise ValueError('Invalid or empty mesh') + * + * self.verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) # <<<<<<<<<<<<<< + * self.triangles = maelloc(sizeof(int[3]) * self.n_triangles, __LINE__) + * + */ + +# line 349 "core/core2.pyx" + __pyx_t_5 = __pyx_f_14softwrap_core2_maelloc(((sizeof(vec3)) * __pyx_v_self->n_verts), __LINE__); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(0, 349, __pyx_L1_error) + +# line 349 "core/core2.pyx" + __pyx_v_self->verts = ((vec3 *)__pyx_t_5); + + /* "core/core2.pyx":350 + * + * self.verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + * self.triangles = maelloc(sizeof(int[3]) * self.n_triangles, __LINE__) # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 350 "core/core2.pyx" + __pyx_t_5 = __pyx_f_14softwrap_core2_maelloc(((sizeof(int [3])) * __pyx_v_self->n_triangles), __LINE__); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(0, 350, __pyx_L1_error) + +# line 350 "core/core2.pyx" + __pyx_v_self->triangles = ((int (*)[3])__pyx_t_5); + + /* "core/core2.pyx":353 + * + * cdef int i + * for i in range(self.n_verts): # <<<<<<<<<<<<<< + * self.verts[i].v = verts[i] + * + */ + +# line 353 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->n_verts; + +# line 353 "core/core2.pyx" + __pyx_t_7 = __pyx_t_6; + +# line 353 "core/core2.pyx" + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + +# line 353 "core/core2.pyx" + __pyx_v_i = __pyx_t_8; + + /* "core/core2.pyx":354 + * cdef int i + * for i in range(self.n_verts): + * self.verts[i].v = verts[i] # <<<<<<<<<<<<<< + * + * for i in range(self.n_triangles): + */ + +# line 354 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_verts, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error) + +# line 354 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 354 "core/core2.pyx" + if (unlikely(__Pyx_carray_from_py_float(__pyx_t_4, __pyx_t_9, 3) < 0)) __PYX_ERR(0, 354, __pyx_L1_error) + +# line 354 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 354 "core/core2.pyx" + memcpy(&((__pyx_v_self->verts[__pyx_v_i]).v[0]), __pyx_t_9, sizeof((__pyx_v_self->verts[__pyx_v_i]).v[0]) * (3)); + +# line 354 "core/core2.pyx" + } + + /* "core/core2.pyx":356 + * self.verts[i].v = verts[i] + * + * for i in range(self.n_triangles): # <<<<<<<<<<<<<< + * self.triangles[i] = triangles[i] + * + */ + +# line 356 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->n_triangles; + +# line 356 "core/core2.pyx" + __pyx_t_7 = __pyx_t_6; + +# line 356 "core/core2.pyx" + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + +# line 356 "core/core2.pyx" + __pyx_v_i = __pyx_t_8; + + /* "core/core2.pyx":357 + * + * for i in range(self.n_triangles): + * self.triangles[i] = triangles[i] # <<<<<<<<<<<<<< + * + * cdef inline vec3*tri_vert_ptr(self, int tri, int tri_i) nogil: + */ + +# line 357 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_triangles, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) + +# line 357 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 357 "core/core2.pyx" + if (unlikely(__Pyx_carray_from_py_int(__pyx_t_4, __pyx_t_10, 3) < 0)) __PYX_ERR(0, 357, __pyx_L1_error) + +# line 357 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 357 "core/core2.pyx" + memcpy(&((__pyx_v_self->triangles[__pyx_v_i])[0]), __pyx_t_10, sizeof((__pyx_v_self->triangles[__pyx_v_i])[0]) * (3)); + +# line 357 "core/core2.pyx" + } + + /* "core/core2.pyx":342 + * return vec3arr_to_list(self.face_normals, self.n_triangles) + * + * def __init__(self, verts, triangles): # <<<<<<<<<<<<<< + * self.n_verts = len(verts) + * self.n_triangles = len(triangles) + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.Mesh.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":359 + * self.triangles[i] = triangles[i] + * + * cdef inline vec3*tri_vert_ptr(self, int tri, int tri_i) nogil: # <<<<<<<<<<<<<< + * return & self.verts[self.triangles[tri][tri_i]] + * + */ + + +# line 359 "core/core2.pyx" +static CYTHON_INLINE vec3 *__pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, int __pyx_v_tri, int __pyx_v_tri_i) { + +# line 359 "core/core2.pyx" + vec3 *__pyx_r; + + /* "core/core2.pyx":360 + * + * cdef inline vec3*tri_vert_ptr(self, int tri, int tri_i) nogil: + * return & self.verts[self.triangles[tri][tri_i]] # <<<<<<<<<<<<<< + * + * cdef inline vec3 tri_vert(self, int tri, int tri_i) nogil: + */ + +# line 360 "core/core2.pyx" + __pyx_r = (&(__pyx_v_self->verts[((__pyx_v_self->triangles[__pyx_v_tri])[__pyx_v_tri_i])])); + +# line 360 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":359 + * self.triangles[i] = triangles[i] + * + * cdef inline vec3*tri_vert_ptr(self, int tri, int tri_i) nogil: # <<<<<<<<<<<<<< + * return & self.verts[self.triangles[tri][tri_i]] + * + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "core/core2.pyx":362 + * return & self.verts[self.triangles[tri][tri_i]] + * + * cdef inline vec3 tri_vert(self, int tri, int tri_i) nogil: # <<<<<<<<<<<<<< + * return self.verts[self.triangles[tri][tri_i]] + * + */ + + +# line 362 "core/core2.pyx" +static CYTHON_INLINE vec3 __pyx_f_14softwrap_core2_4Mesh_tri_vert(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, int __pyx_v_tri, int __pyx_v_tri_i) { + +# line 362 "core/core2.pyx" + vec3 __pyx_r; + + /* "core/core2.pyx":363 + * + * cdef inline vec3 tri_vert(self, int tri, int tri_i) nogil: + * return self.verts[self.triangles[tri][tri_i]] # <<<<<<<<<<<<<< + * + * cpdef void update_face_normals(self): + */ + +# line 363 "core/core2.pyx" + __pyx_r = (__pyx_v_self->verts[((__pyx_v_self->triangles[__pyx_v_tri])[__pyx_v_tri_i])]); + +# line 363 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":362 + * return & self.verts[self.triangles[tri][tri_i]] + * + * cdef inline vec3 tri_vert(self, int tri, int tri_i) nogil: # <<<<<<<<<<<<<< + * return self.verts[self.triangles[tri][tri_i]] + * + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "core/core2.pyx":365 + * return self.verts[self.triangles[tri][tri_i]] + * + * cpdef void update_face_normals(self): # <<<<<<<<<<<<<< + * if not self.face_normals: + * self.face_normals = caelloc(self.n_triangles, sizeof(vec3), __LINE__) + */ + +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_7update_face_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_14softwrap_core2_4Mesh_update_face_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_v_i; + vec3 *__pyx_v_a; + vec3 *__pyx_v_b; + vec3 *__pyx_v_c; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + void *__pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_face_normals", 0); + + /* "core/core2.pyx":366 + * + * cpdef void update_face_normals(self): + * if not self.face_normals: # <<<<<<<<<<<<<< + * self.face_normals = caelloc(self.n_triangles, sizeof(vec3), __LINE__) + * + */ + +# line 366 "core/core2.pyx" + __pyx_t_1 = ((!(__pyx_v_self->face_normals != 0)) != 0); + +# line 366 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":367 + * cpdef void update_face_normals(self): + * if not self.face_normals: + * self.face_normals = caelloc(self.n_triangles, sizeof(vec3), __LINE__) # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 367 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_caelloc(__pyx_v_self->n_triangles, (sizeof(vec3)), __LINE__); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 367, __pyx_L1_error) + +# line 367 "core/core2.pyx" + __pyx_v_self->face_normals = ((vec3 *)__pyx_t_2); + + /* "core/core2.pyx":366 + * + * cpdef void update_face_normals(self): + * if not self.face_normals: # <<<<<<<<<<<<<< + * self.face_normals = caelloc(self.n_triangles, sizeof(vec3), __LINE__) + * + */ + +# line 366 "core/core2.pyx" + } + + /* "core/core2.pyx":374 + * cdef vec3* b + * cdef vec3* c + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_triangles): + * a = self.tri_vert_ptr(i, 0) + */ + +# line 374 "core/core2.pyx" + { + +# line 374 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 374 "core/core2.pyx" + PyThreadState *_save; + +# line 374 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 374 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 374 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":375 + * cdef vec3* c + * with nogil: + * for i in prange(self.n_triangles): # <<<<<<<<<<<<<< + * a = self.tri_vert_ptr(i, 0) + * b = self.tri_vert_ptr(i, 1) + */ + +# line 375 "core/core2.pyx" + __pyx_t_3 = __pyx_v_self->n_triangles; + +# line 375 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 375 "core/core2.pyx" + { + +# line 375 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 375 "core/core2.pyx" + #undef likely + +# line 375 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 375 "core/core2.pyx" + #endif + +# line 375 "core/core2.pyx" + __pyx_t_5 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + +# line 375 "core/core2.pyx" + if (__pyx_t_5 > 0) + +# line 375 "core/core2.pyx" + { + +# line 375 "core/core2.pyx" + #ifdef _OPENMP + +# line 375 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_a) lastprivate(__pyx_v_b) lastprivate(__pyx_v_c) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_4); + /* Initialize private variables to invalid values */ + __pyx_v_a = ((vec3 *)1); + __pyx_v_b = ((vec3 *)1); + __pyx_v_c = ((vec3 *)1); + + /* "core/core2.pyx":376 + * with nogil: + * for i in prange(self.n_triangles): + * a = self.tri_vert_ptr(i, 0) # <<<<<<<<<<<<<< + * b = self.tri_vert_ptr(i, 1) + * c = self.tri_vert_ptr(i, 2) + */ + +# line 376 "core/core2.pyx" + __pyx_v_a = __pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr(__pyx_v_self, __pyx_v_i, 0); + + /* "core/core2.pyx":377 + * for i in prange(self.n_triangles): + * a = self.tri_vert_ptr(i, 0) + * b = self.tri_vert_ptr(i, 1) # <<<<<<<<<<<<<< + * c = self.tri_vert_ptr(i, 2) + * self.face_normals[i] = (b[0] - a[0]).cross(c[0] - a[0]).normalized() + */ + +# line 377 "core/core2.pyx" + __pyx_v_b = __pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr(__pyx_v_self, __pyx_v_i, 1); + + /* "core/core2.pyx":378 + * a = self.tri_vert_ptr(i, 0) + * b = self.tri_vert_ptr(i, 1) + * c = self.tri_vert_ptr(i, 2) # <<<<<<<<<<<<<< + * self.face_normals[i] = (b[0] - a[0]).cross(c[0] - a[0]).normalized() + * + */ + +# line 378 "core/core2.pyx" + __pyx_v_c = __pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr(__pyx_v_self, __pyx_v_i, 2); + + /* "core/core2.pyx":379 + * b = self.tri_vert_ptr(i, 1) + * c = self.tri_vert_ptr(i, 2) + * self.face_normals[i] = (b[0] - a[0]).cross(c[0] - a[0]).normalized() # <<<<<<<<<<<<<< + * + * cpdef void update_vert_normals(self): + */ + +# line 379 "core/core2.pyx" + (__pyx_v_self->face_normals[__pyx_v_i]) = ((__pyx_v_b[0]) - (__pyx_v_a[0])).cross(((__pyx_v_c[0]) - (__pyx_v_a[0]))).normalized(); + +# line 379 "core/core2.pyx" + } + +# line 379 "core/core2.pyx" + } + +# line 379 "core/core2.pyx" + } + +# line 379 "core/core2.pyx" + } + +# line 379 "core/core2.pyx" + } + +# line 379 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 379 "core/core2.pyx" + #undef likely + +# line 379 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 379 "core/core2.pyx" + #endif + +# line 379 "core/core2.pyx" + } + + /* "core/core2.pyx":374 + * cdef vec3* b + * cdef vec3* c + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_triangles): + * a = self.tri_vert_ptr(i, 0) + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":365 + * return self.verts[self.triangles[tri][tri_i]] + * + * cpdef void update_face_normals(self): # <<<<<<<<<<<<<< + * if not self.face_normals: + * self.face_normals = caelloc(self.n_triangles, sizeof(vec3), __LINE__) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("softwrap_core2.Mesh.update_face_normals", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_7update_face_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_7update_face_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update_face_normals (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_4Mesh_6update_face_normals(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_6update_face_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_face_normals", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_4Mesh_update_face_normals(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.Mesh.update_face_normals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":381 + * self.face_normals[i] = (b[0] - a[0]).cross(c[0] - a[0]).normalized() + * + * cpdef void update_vert_normals(self): # <<<<<<<<<<<<<< + * if not self.vert_normals: + * self.vert_normals = caelloc(self.n_verts, sizeof(vec3), __LINE__) + */ + +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_9update_vert_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_14softwrap_core2_4Mesh_update_vert_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_j; + int *__pyx_v_tri; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + void *__pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_vert_normals", 0); + + /* "core/core2.pyx":382 + * + * cpdef void update_vert_normals(self): + * if not self.vert_normals: # <<<<<<<<<<<<<< + * self.vert_normals = caelloc(self.n_verts, sizeof(vec3), __LINE__) + * + */ + +# line 382 "core/core2.pyx" + __pyx_t_1 = ((!(__pyx_v_self->vert_normals != 0)) != 0); + +# line 382 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":383 + * cpdef void update_vert_normals(self): + * if not self.vert_normals: + * self.vert_normals = caelloc(self.n_verts, sizeof(vec3), __LINE__) # <<<<<<<<<<<<<< + * + * cdef int i, j + */ + +# line 383 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_caelloc(__pyx_v_self->n_verts, (sizeof(vec3)), __LINE__); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 383, __pyx_L1_error) + +# line 383 "core/core2.pyx" + __pyx_v_self->vert_normals = ((vec3 *)__pyx_t_2); + + /* "core/core2.pyx":382 + * + * cpdef void update_vert_normals(self): + * if not self.vert_normals: # <<<<<<<<<<<<<< + * self.vert_normals = caelloc(self.n_verts, sizeof(vec3), __LINE__) + * + */ + +# line 382 "core/core2.pyx" + } + + /* "core/core2.pyx":389 + * cdef int * tri + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * self.vert_normals[i] = vec3(0) + */ + +# line 389 "core/core2.pyx" + { + +# line 389 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 389 "core/core2.pyx" + PyThreadState *_save; + +# line 389 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 389 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 389 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":390 + * + * with nogil: + * for i in prange(self.n_verts): # <<<<<<<<<<<<<< + * self.vert_normals[i] = vec3(0) + * + */ + +# line 390 "core/core2.pyx" + __pyx_t_3 = __pyx_v_self->n_verts; + +# line 390 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 390 "core/core2.pyx" + { + +# line 390 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 390 "core/core2.pyx" + #undef likely + +# line 390 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 390 "core/core2.pyx" + #endif + +# line 390 "core/core2.pyx" + __pyx_t_5 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + +# line 390 "core/core2.pyx" + if (__pyx_t_5 > 0) + +# line 390 "core/core2.pyx" + { + +# line 390 "core/core2.pyx" + #ifdef _OPENMP + +# line 390 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_4); + + /* "core/core2.pyx":391 + * with nogil: + * for i in prange(self.n_verts): + * self.vert_normals[i] = vec3(0) # <<<<<<<<<<<<<< + * + * for i in range(self.n_triangles): + */ + +# line 391 "core/core2.pyx" + (__pyx_v_self->vert_normals[__pyx_v_i]) = vec3(0.0); + +# line 391 "core/core2.pyx" + } + +# line 391 "core/core2.pyx" + } + +# line 391 "core/core2.pyx" + } + +# line 391 "core/core2.pyx" + } + +# line 391 "core/core2.pyx" + } + +# line 391 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 391 "core/core2.pyx" + #undef likely + +# line 391 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 391 "core/core2.pyx" + #endif + + /* "core/core2.pyx":393 + * self.vert_normals[i] = vec3(0) + * + * for i in range(self.n_triangles): # <<<<<<<<<<<<<< + * tri = self.triangles[i] + * for j in range(3): + */ + +# line 393 "core/core2.pyx" + __pyx_t_5 = __pyx_v_self->n_triangles; + +# line 393 "core/core2.pyx" + __pyx_t_4 = __pyx_t_5; + +# line 393 "core/core2.pyx" + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3+=1) { + +# line 393 "core/core2.pyx" + __pyx_v_i = __pyx_t_3; + + /* "core/core2.pyx":394 + * + * for i in range(self.n_triangles): + * tri = self.triangles[i] # <<<<<<<<<<<<<< + * for j in range(3): + * self.vert_normals[tri[j]] += self.face_normals[i] + */ + +# line 394 "core/core2.pyx" + __pyx_v_tri = ((int *)(__pyx_v_self->triangles[__pyx_v_i])); + + /* "core/core2.pyx":395 + * for i in range(self.n_triangles): + * tri = self.triangles[i] + * for j in range(3): # <<<<<<<<<<<<<< + * self.vert_normals[tri[j]] += self.face_normals[i] + * + */ + +# line 395 "core/core2.pyx" + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + +# line 395 "core/core2.pyx" + __pyx_v_j = __pyx_t_6; + + /* "core/core2.pyx":396 + * tri = self.triangles[i] + * for j in range(3): + * self.vert_normals[tri[j]] += self.face_normals[i] # <<<<<<<<<<<<<< + * + * for i in prange(self.n_verts): + */ + +# line 396 "core/core2.pyx" + (__pyx_v_self->vert_normals[(__pyx_v_tri[__pyx_v_j])]) += (__pyx_v_self->face_normals[__pyx_v_i]); + +# line 396 "core/core2.pyx" + } + +# line 396 "core/core2.pyx" + } + + /* "core/core2.pyx":398 + * self.vert_normals[tri[j]] += self.face_normals[i] + * + * for i in prange(self.n_verts): # <<<<<<<<<<<<<< + * self.vert_normals[i].normalize() + * + */ + +# line 398 "core/core2.pyx" + __pyx_t_5 = __pyx_v_self->n_verts; + +# line 398 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 398 "core/core2.pyx" + { + +# line 398 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 398 "core/core2.pyx" + #undef likely + +# line 398 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 398 "core/core2.pyx" + #endif + +# line 398 "core/core2.pyx" + __pyx_t_3 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1; + +# line 398 "core/core2.pyx" + if (__pyx_t_3 > 0) + +# line 398 "core/core2.pyx" + { + +# line 398 "core/core2.pyx" + #ifdef _OPENMP + +# line 398 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_4); + + /* "core/core2.pyx":399 + * + * for i in prange(self.n_verts): + * self.vert_normals[i].normalize() # <<<<<<<<<<<<<< + * + * cpdef void update_centroids(self): + */ + +# line 399 "core/core2.pyx" + (__pyx_v_self->vert_normals[__pyx_v_i]).normalize(); + +# line 399 "core/core2.pyx" + } + +# line 399 "core/core2.pyx" + } + +# line 399 "core/core2.pyx" + } + +# line 399 "core/core2.pyx" + } + +# line 399 "core/core2.pyx" + } + +# line 399 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 399 "core/core2.pyx" + #undef likely + +# line 399 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 399 "core/core2.pyx" + #endif + +# line 399 "core/core2.pyx" + } + + /* "core/core2.pyx":389 + * cdef int * tri + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * self.vert_normals[i] = vec3(0) + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":381 + * self.face_normals[i] = (b[0] - a[0]).cross(c[0] - a[0]).normalized() + * + * cpdef void update_vert_normals(self): # <<<<<<<<<<<<<< + * if not self.vert_normals: + * self.vert_normals = caelloc(self.n_verts, sizeof(vec3), __LINE__) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("softwrap_core2.Mesh.update_vert_normals", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_9update_vert_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_9update_vert_normals(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update_vert_normals (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_4Mesh_8update_vert_normals(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_8update_vert_normals(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_vert_normals", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_4Mesh_update_vert_normals(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.Mesh.update_vert_normals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":401 + * self.vert_normals[i].normalize() + * + * cpdef void update_centroids(self): # <<<<<<<<<<<<<< + * if not self.centroids: + * self.centroids = maelloc(sizeof(vec3) * self.n_triangles, __LINE__) + */ + +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_11update_centroids(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_14softwrap_core2_4Mesh_update_centroids(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + void *__pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_centroids", 0); + + /* "core/core2.pyx":402 + * + * cpdef void update_centroids(self): + * if not self.centroids: # <<<<<<<<<<<<<< + * self.centroids = maelloc(sizeof(vec3) * self.n_triangles, __LINE__) + * + */ + +# line 402 "core/core2.pyx" + __pyx_t_1 = ((!(__pyx_v_self->centroids != 0)) != 0); + +# line 402 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":403 + * cpdef void update_centroids(self): + * if not self.centroids: + * self.centroids = maelloc(sizeof(vec3) * self.n_triangles, __LINE__) # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 403 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_maelloc(((sizeof(vec3)) * __pyx_v_self->n_triangles), __LINE__); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 403, __pyx_L1_error) + +# line 403 "core/core2.pyx" + __pyx_v_self->centroids = ((vec3 *)__pyx_t_2); + + /* "core/core2.pyx":402 + * + * cpdef void update_centroids(self): + * if not self.centroids: # <<<<<<<<<<<<<< + * self.centroids = maelloc(sizeof(vec3) * self.n_triangles, __LINE__) + * + */ + +# line 402 "core/core2.pyx" + } + + /* "core/core2.pyx":406 + * + * cdef int i + * for i in prange(self.n_triangles, nogil=True): # <<<<<<<<<<<<<< + * self.centroids[i] = (self.tri_vert(i, 0) + self.tri_vert(i, 1) + self.tri_vert(i, 2)) / 3 + * + */ + +# line 406 "core/core2.pyx" + { + +# line 406 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 406 "core/core2.pyx" + PyThreadState *_save; + +# line 406 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 406 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 406 "core/core2.pyx" + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_self->n_triangles; + if ((1 == 0)) abort(); + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_5 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_5 > 0) + { + #ifdef _OPENMP + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_4); + + /* "core/core2.pyx":407 + * cdef int i + * for i in prange(self.n_triangles, nogil=True): + * self.centroids[i] = (self.tri_vert(i, 0) + self.tri_vert(i, 1) + self.tri_vert(i, 2)) / 3 # <<<<<<<<<<<<<< + * + * + */ + +# line 407 "core/core2.pyx" + (__pyx_v_self->centroids[__pyx_v_i]) = (((__pyx_f_14softwrap_core2_4Mesh_tri_vert(__pyx_v_self, __pyx_v_i, 0) + __pyx_f_14softwrap_core2_4Mesh_tri_vert(__pyx_v_self, __pyx_v_i, 1)) + __pyx_f_14softwrap_core2_4Mesh_tri_vert(__pyx_v_self, __pyx_v_i, 2)) / 3.0); + +# line 407 "core/core2.pyx" + } + +# line 407 "core/core2.pyx" + } + +# line 407 "core/core2.pyx" + } + +# line 407 "core/core2.pyx" + } + +# line 407 "core/core2.pyx" + } + +# line 407 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 407 "core/core2.pyx" + #undef likely + +# line 407 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 407 "core/core2.pyx" + #endif + +# line 407 "core/core2.pyx" + } + + /* "core/core2.pyx":406 + * + * cdef int i + * for i in prange(self.n_triangles, nogil=True): # <<<<<<<<<<<<<< + * self.centroids[i] = (self.tri_vert(i, 0) + self.tri_vert(i, 1) + self.tri_vert(i, 2)) / 3 + * + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":401 + * self.vert_normals[i].normalize() + * + * cpdef void update_centroids(self): # <<<<<<<<<<<<<< + * if not self.centroids: + * self.centroids = maelloc(sizeof(vec3) * self.n_triangles, __LINE__) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("softwrap_core2.Mesh.update_centroids", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_11update_centroids(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_11update_centroids(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update_centroids (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_4Mesh_10update_centroids(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_10update_centroids(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_centroids", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_4Mesh_update_centroids(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.Mesh.update_centroids", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":410 + * + * + * def closest_vert(self, pos): # <<<<<<<<<<<<<< + * cdef vec3 p + * cdef float tmp_dist, dist = INFINITY + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_13closest_vert(PyObject *__pyx_v_self, PyObject *__pyx_v_pos); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_13closest_vert(PyObject *__pyx_v_self, PyObject *__pyx_v_pos) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("closest_vert (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_4Mesh_12closest_vert(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self), ((PyObject *)__pyx_v_pos)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_12closest_vert(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, PyObject *__pyx_v_pos) { + vec3 __pyx_v_p; + float __pyx_v_tmp_dist; + float __pyx_v_dist; + int __pyx_v_i; + int __pyx_v_idx; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + float __pyx_t_1[3]; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("closest_vert", 0); + + /* "core/core2.pyx":412 + * def closest_vert(self, pos): + * cdef vec3 p + * cdef float tmp_dist, dist = INFINITY # <<<<<<<<<<<<<< + * cdef int i=0, idx = -1 + * + */ + +# line 412 "core/core2.pyx" + __pyx_v_dist = INFINITY; + + /* "core/core2.pyx":413 + * cdef vec3 p + * cdef float tmp_dist, dist = INFINITY + * cdef int i=0, idx = -1 # <<<<<<<<<<<<<< + * + * p.v = pos + */ + +# line 413 "core/core2.pyx" + __pyx_v_i = 0; + +# line 413 "core/core2.pyx" + __pyx_v_idx = -1; + + /* "core/core2.pyx":415 + * cdef int i=0, idx = -1 + * + * p.v = pos # <<<<<<<<<<<<<< + * + * for i in range(self.n_verts): + */ + +# line 415 "core/core2.pyx" + if (unlikely(__Pyx_carray_from_py_float(__pyx_v_pos, __pyx_t_1, 3) < 0)) __PYX_ERR(0, 415, __pyx_L1_error) + +# line 415 "core/core2.pyx" + memcpy(&(__pyx_v_p.v[0]), __pyx_t_1, sizeof(__pyx_v_p.v[0]) * (3)); + + /* "core/core2.pyx":417 + * p.v = pos + * + * for i in range(self.n_verts): # <<<<<<<<<<<<<< + * tmp_dist = (self.verts[i] - p).len_sqr() + * if tmp_dist < dist: + */ + +# line 417 "core/core2.pyx" + __pyx_t_2 = __pyx_v_self->n_verts; + +# line 417 "core/core2.pyx" + __pyx_t_3 = __pyx_t_2; + +# line 417 "core/core2.pyx" + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + +# line 417 "core/core2.pyx" + __pyx_v_i = __pyx_t_4; + + /* "core/core2.pyx":418 + * + * for i in range(self.n_verts): + * tmp_dist = (self.verts[i] - p).len_sqr() # <<<<<<<<<<<<<< + * if tmp_dist < dist: + * dist = tmp_dist + */ + +# line 418 "core/core2.pyx" + __pyx_v_tmp_dist = ((__pyx_v_self->verts[__pyx_v_i]) - __pyx_v_p).len_sqr(); + + /* "core/core2.pyx":419 + * for i in range(self.n_verts): + * tmp_dist = (self.verts[i] - p).len_sqr() + * if tmp_dist < dist: # <<<<<<<<<<<<<< + * dist = tmp_dist + * idx = i + */ + +# line 419 "core/core2.pyx" + __pyx_t_5 = ((__pyx_v_tmp_dist < __pyx_v_dist) != 0); + +# line 419 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":420 + * tmp_dist = (self.verts[i] - p).len_sqr() + * if tmp_dist < dist: + * dist = tmp_dist # <<<<<<<<<<<<<< + * idx = i + * + */ + +# line 420 "core/core2.pyx" + __pyx_v_dist = __pyx_v_tmp_dist; + + /* "core/core2.pyx":421 + * if tmp_dist < dist: + * dist = tmp_dist + * idx = i # <<<<<<<<<<<<<< + * + * return idx, self.verts[idx].v + */ + +# line 421 "core/core2.pyx" + __pyx_v_idx = __pyx_v_i; + + /* "core/core2.pyx":419 + * for i in range(self.n_verts): + * tmp_dist = (self.verts[i] - p).len_sqr() + * if tmp_dist < dist: # <<<<<<<<<<<<<< + * dist = tmp_dist + * idx = i + */ + +# line 419 "core/core2.pyx" + } + +# line 419 "core/core2.pyx" + } + + /* "core/core2.pyx":423 + * idx = i + * + * return idx, self.verts[idx].v # <<<<<<<<<<<<<< + * + * + */ + +# line 423 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 423 "core/core2.pyx" + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 423, __pyx_L1_error) + +# line 423 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_6); + +# line 423 "core/core2.pyx" + __pyx_t_7 = __Pyx_carray_to_py_float((__pyx_v_self->verts[__pyx_v_idx]).v, 3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L1_error) + +# line 423 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 423 "core/core2.pyx" + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 423, __pyx_L1_error) + +# line 423 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 423 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_6); + +# line 423 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); + +# line 423 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_7); + +# line 423 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); + +# line 423 "core/core2.pyx" + __pyx_t_6 = 0; + +# line 423 "core/core2.pyx" + __pyx_t_7 = 0; + +# line 423 "core/core2.pyx" + __pyx_r = __pyx_t_8; + +# line 423 "core/core2.pyx" + __pyx_t_8 = 0; + +# line 423 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":410 + * + * + * def closest_vert(self, pos): # <<<<<<<<<<<<<< + * cdef vec3 p + * cdef float tmp_dist, dist = INFINITY + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("softwrap_core2.Mesh.closest_vert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":426 + * + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.verts) + * fraeee(self.triangles) + */ + +/* Python wrapper */ +static void __pyx_pw_14softwrap_core2_4Mesh_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_14softwrap_core2_4Mesh_15__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_14softwrap_core2_4Mesh_14__dealloc__(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_14softwrap_core2_4Mesh_14__dealloc__(struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "core/core2.pyx":427 + * + * def __dealloc__(self): + * fraeee(self.verts) # <<<<<<<<<<<<<< + * fraeee(self.triangles) + * fraeee(self.centroids) + */ + +# line 427 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->verts); + + /* "core/core2.pyx":428 + * def __dealloc__(self): + * fraeee(self.verts) + * fraeee(self.triangles) # <<<<<<<<<<<<<< + * fraeee(self.centroids) + * fraeee(self.face_normals) + */ + +# line 428 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->triangles); + + /* "core/core2.pyx":429 + * fraeee(self.verts) + * fraeee(self.triangles) + * fraeee(self.centroids) # <<<<<<<<<<<<<< + * fraeee(self.face_normals) + * fraeee(self.vert_normals) + */ + +# line 429 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->centroids); + + /* "core/core2.pyx":430 + * fraeee(self.triangles) + * fraeee(self.centroids) + * fraeee(self.face_normals) # <<<<<<<<<<<<<< + * fraeee(self.vert_normals) + * + */ + +# line 430 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->face_normals); + + /* "core/core2.pyx":431 + * fraeee(self.centroids) + * fraeee(self.face_normals) + * fraeee(self.vert_normals) # <<<<<<<<<<<<<< + * + * + */ + +# line 431 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->vert_normals); + + /* "core/core2.pyx":426 + * + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.verts) + * fraeee(self.triangles) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_4Mesh_16__reduce_cython__(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.Mesh.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_4Mesh_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_4Mesh_18__setstate_cython__(((struct __pyx_obj_14softwrap_core2_Mesh *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_4Mesh_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.Mesh.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":564 + * Mesh mesh + * + * def __cinit__(self, Mesh mesh): # <<<<<<<<<<<<<< + * self.mesh = mesh + * if mesh == None: + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_3BVH_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_3BVH_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_mesh = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mesh,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mesh)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 564, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_mesh = ((struct __pyx_obj_14softwrap_core2_Mesh *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 564, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.BVH.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mesh), __pyx_ptype_14softwrap_core2_Mesh, 1, "mesh", 0))) __PYX_ERR(0, 564, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_3BVH___cinit__(((struct __pyx_obj_14softwrap_core2_BVH *)__pyx_v_self), __pyx_v_mesh); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_3BVH___cinit__(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_mesh) { + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + void *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "core/core2.pyx":565 + * + * def __cinit__(self, Mesh mesh): + * self.mesh = mesh # <<<<<<<<<<<<<< + * if mesh == None: + * raise ValueError + */ + +# line 565 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_mesh)); + +# line 565 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_mesh)); + +# line 565 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->mesh); + +# line 565 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->mesh)); + +# line 565 "core/core2.pyx" + __pyx_v_self->mesh = __pyx_v_mesh; + + /* "core/core2.pyx":566 + * def __cinit__(self, Mesh mesh): + * self.mesh = mesh + * if mesh == None: # <<<<<<<<<<<<<< + * raise ValueError + * + */ + +# line 566 "core/core2.pyx" + __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_mesh), Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error) + +# line 566 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 566, __pyx_L1_error) + +# line 566 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 566 "core/core2.pyx" + if (unlikely(__pyx_t_2)) { + + /* "core/core2.pyx":567 + * self.mesh = mesh + * if mesh == None: + * raise ValueError # <<<<<<<<<<<<<< + * + * self.size = mesh.n_triangles + */ + +# line 567 "core/core2.pyx" + __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0); + +# line 567 "core/core2.pyx" + __PYX_ERR(0, 567, __pyx_L1_error) + + /* "core/core2.pyx":566 + * def __cinit__(self, Mesh mesh): + * self.mesh = mesh + * if mesh == None: # <<<<<<<<<<<<<< + * raise ValueError + * + */ + +# line 566 "core/core2.pyx" + } + + /* "core/core2.pyx":569 + * raise ValueError + * + * self.size = mesh.n_triangles # <<<<<<<<<<<<<< + * self.leaves = maelloc(sizeof(BvhNodeLeaf) * self.size, __LINE__) + * self.boxes = maelloc(sizeof(BvhNodeBox) * self.size, __LINE__) + */ + +# line 569 "core/core2.pyx" + __pyx_t_3 = __pyx_v_mesh->n_triangles; + +# line 569 "core/core2.pyx" + __pyx_v_self->size = __pyx_t_3; + + /* "core/core2.pyx":570 + * + * self.size = mesh.n_triangles + * self.leaves = maelloc(sizeof(BvhNodeLeaf) * self.size, __LINE__) # <<<<<<<<<<<<<< + * self.boxes = maelloc(sizeof(BvhNodeBox) * self.size, __LINE__) + * self.free_box_idx = self.size + */ + +# line 570 "core/core2.pyx" + __pyx_t_4 = __pyx_f_14softwrap_core2_maelloc(((sizeof(BvhNodeLeaf)) * __pyx_v_self->size), __LINE__); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(0, 570, __pyx_L1_error) + +# line 570 "core/core2.pyx" + __pyx_v_self->leaves = ((BvhNodeLeaf *)__pyx_t_4); + + /* "core/core2.pyx":571 + * self.size = mesh.n_triangles + * self.leaves = maelloc(sizeof(BvhNodeLeaf) * self.size, __LINE__) + * self.boxes = maelloc(sizeof(BvhNodeBox) * self.size, __LINE__) # <<<<<<<<<<<<<< + * self.free_box_idx = self.size + * + */ + +# line 571 "core/core2.pyx" + __pyx_t_4 = __pyx_f_14softwrap_core2_maelloc(((sizeof(BvhNodeBox)) * __pyx_v_self->size), __LINE__); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(0, 571, __pyx_L1_error) + +# line 571 "core/core2.pyx" + __pyx_v_self->boxes = ((BvhNodeBox *)__pyx_t_4); + + /* "core/core2.pyx":572 + * self.leaves = maelloc(sizeof(BvhNodeLeaf) * self.size, __LINE__) + * self.boxes = maelloc(sizeof(BvhNodeBox) * self.size, __LINE__) + * self.free_box_idx = self.size # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 572 "core/core2.pyx" + __pyx_t_3 = __pyx_v_self->size; + +# line 572 "core/core2.pyx" + __pyx_v_self->free_box_idx = __pyx_t_3; + + /* "core/core2.pyx":575 + * + * cdef int i + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.size): + * self.leaves[i].index = i + */ + +# line 575 "core/core2.pyx" + { + +# line 575 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 575 "core/core2.pyx" + PyThreadState *_save; + +# line 575 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 575 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 575 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":576 + * cdef int i + * with nogil: + * for i in prange(self.size): # <<<<<<<<<<<<<< + * self.leaves[i].index = i + * self.boxes[i].split_axis = -1; + */ + +# line 576 "core/core2.pyx" + __pyx_t_3 = __pyx_v_self->size; + +# line 576 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 576 "core/core2.pyx" + { + +# line 576 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 576 "core/core2.pyx" + #undef likely + +# line 576 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 576 "core/core2.pyx" + #endif + +# line 576 "core/core2.pyx" + __pyx_t_6 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + +# line 576 "core/core2.pyx" + if (__pyx_t_6 > 0) + +# line 576 "core/core2.pyx" + { + +# line 576 "core/core2.pyx" + #ifdef _OPENMP + +# line 576 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_5); + + /* "core/core2.pyx":577 + * with nogil: + * for i in prange(self.size): + * self.leaves[i].index = i # <<<<<<<<<<<<<< + * self.boxes[i].split_axis = -1; + * self.boxes[i].min = vec3(INFINITY); + */ + +# line 577 "core/core2.pyx" + (__pyx_v_self->leaves[__pyx_v_i]).index = __pyx_v_i; + + /* "core/core2.pyx":578 + * for i in prange(self.size): + * self.leaves[i].index = i + * self.boxes[i].split_axis = -1; # <<<<<<<<<<<<<< + * self.boxes[i].min = vec3(INFINITY); + * self.boxes[i].max = vec3(-INFINITY); + */ + +# line 578 "core/core2.pyx" + (__pyx_v_self->boxes[__pyx_v_i]).split_axis = -1; + + /* "core/core2.pyx":579 + * self.leaves[i].index = i + * self.boxes[i].split_axis = -1; + * self.boxes[i].min = vec3(INFINITY); # <<<<<<<<<<<<<< + * self.boxes[i].max = vec3(-INFINITY); + * + */ + +# line 579 "core/core2.pyx" + (__pyx_v_self->boxes[__pyx_v_i]).min = vec3(INFINITY); + + /* "core/core2.pyx":580 + * self.boxes[i].split_axis = -1; + * self.boxes[i].min = vec3(INFINITY); + * self.boxes[i].max = vec3(-INFINITY); # <<<<<<<<<<<<<< + * + * self.mesh.update_centroids() + */ + +# line 580 "core/core2.pyx" + (__pyx_v_self->boxes[__pyx_v_i]).max = vec3((-INFINITY)); + +# line 580 "core/core2.pyx" + } + +# line 580 "core/core2.pyx" + } + +# line 580 "core/core2.pyx" + } + +# line 580 "core/core2.pyx" + } + +# line 580 "core/core2.pyx" + } + +# line 580 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 580 "core/core2.pyx" + #undef likely + +# line 580 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 580 "core/core2.pyx" + #endif + +# line 580 "core/core2.pyx" + } + + /* "core/core2.pyx":575 + * + * cdef int i + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.size): + * self.leaves[i].index = i + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":582 + * self.boxes[i].max = vec3(-INFINITY); + * + * self.mesh.update_centroids() # <<<<<<<<<<<<<< + * self.mesh.update_face_normals() + * self.root = self.build_tree(self.leaves, self.size) + */ + +# line 582 "core/core2.pyx" + __pyx_f_14softwrap_core2_4Mesh_update_centroids(__pyx_v_self->mesh, 0); + + /* "core/core2.pyx":583 + * + * self.mesh.update_centroids() + * self.mesh.update_face_normals() # <<<<<<<<<<<<<< + * self.root = self.build_tree(self.leaves, self.size) + * + */ + +# line 583 "core/core2.pyx" + __pyx_f_14softwrap_core2_4Mesh_update_face_normals(__pyx_v_self->mesh, 0); + + /* "core/core2.pyx":584 + * self.mesh.update_centroids() + * self.mesh.update_face_normals() + * self.root = self.build_tree(self.leaves, self.size) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + +# line 584 "core/core2.pyx" + __pyx_v_self->root = __pyx_f_14softwrap_core2_3BVH_build_tree(__pyx_v_self, __pyx_v_self->leaves, __pyx_v_self->size); + + /* "core/core2.pyx":564 + * Mesh mesh + * + * def __cinit__(self, Mesh mesh): # <<<<<<<<<<<<<< + * self.mesh = mesh + * if mesh == None: + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.BVH.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":586 + * self.root = self.build_tree(self.leaves, self.size) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.leaves) + * fraeee(self.boxes) + */ + +/* Python wrapper */ +static void __pyx_pw_14softwrap_core2_3BVH_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_14softwrap_core2_3BVH_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_14softwrap_core2_3BVH_2__dealloc__(((struct __pyx_obj_14softwrap_core2_BVH *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_14softwrap_core2_3BVH_2__dealloc__(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "core/core2.pyx":587 + * + * def __dealloc__(self): + * fraeee(self.leaves) # <<<<<<<<<<<<<< + * fraeee(self.boxes) + * + */ + +# line 587 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->leaves); + + /* "core/core2.pyx":588 + * def __dealloc__(self): + * fraeee(self.leaves) + * fraeee(self.boxes) # <<<<<<<<<<<<<< + * + * cdef inline BvhNodeBox* pop_box(self) nogil: + */ + +# line 588 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->boxes); + + /* "core/core2.pyx":586 + * self.root = self.build_tree(self.leaves, self.size) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.leaves) + * fraeee(self.boxes) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "core/core2.pyx":590 + * fraeee(self.boxes) + * + * cdef inline BvhNodeBox* pop_box(self) nogil: # <<<<<<<<<<<<<< + * self.free_box_idx -= 1 + * # if self.free_box_idx < 0: + */ + + +# line 590 "core/core2.pyx" +static CYTHON_INLINE BvhNodeBox *__pyx_f_14softwrap_core2_3BVH_pop_box(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self) { + +# line 590 "core/core2.pyx" + BvhNodeBox *__pyx_r; + + /* "core/core2.pyx":591 + * + * cdef inline BvhNodeBox* pop_box(self) nogil: + * self.free_box_idx -= 1 # <<<<<<<<<<<<<< + * # if self.free_box_idx < 0: + * # raise RuntimeError('Ran out of boxes') + */ + +# line 591 "core/core2.pyx" + __pyx_v_self->free_box_idx = (__pyx_v_self->free_box_idx - 1); + + /* "core/core2.pyx":595 + * # raise RuntimeError('Ran out of boxes') + * + * return & self.boxes[self.free_box_idx] # <<<<<<<<<<<<<< + * + * cdef BvhNode* build_tree(self, BvhNodeLeaf* leaves, int size) nogil: + */ + +# line 595 "core/core2.pyx" + __pyx_r = (&(__pyx_v_self->boxes[__pyx_v_self->free_box_idx])); + +# line 595 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":590 + * fraeee(self.boxes) + * + * cdef inline BvhNodeBox* pop_box(self) nogil: # <<<<<<<<<<<<<< + * self.free_box_idx -= 1 + * # if self.free_box_idx < 0: + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "core/core2.pyx":597 + * return & self.boxes[self.free_box_idx] + * + * cdef BvhNode* build_tree(self, BvhNodeLeaf* leaves, int size) nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * + */ + + +# line 597 "core/core2.pyx" +static union BvhNode *__pyx_f_14softwrap_core2_3BVH_build_tree(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, BvhNodeLeaf *__pyx_v_leaves, int __pyx_v_size) { + +# line 597 "core/core2.pyx" + int __pyx_v_i; + +# line 597 "core/core2.pyx" + int __pyx_v_j; + +# line 597 "core/core2.pyx" + BvhNodeBox *__pyx_v_box; + +# line 597 "core/core2.pyx" + vec3 __pyx_v_median; + +# line 597 "core/core2.pyx" + int __pyx_v_axis; + +# line 597 "core/core2.pyx" + union BvhNode *__pyx_r; + +# line 597 "core/core2.pyx" + int __pyx_t_1; + +# line 597 "core/core2.pyx" + int __pyx_t_2; + +# line 597 "core/core2.pyx" + int __pyx_t_3; + +# line 597 "core/core2.pyx" + int __pyx_t_4; + +# line 597 "core/core2.pyx" + int __pyx_t_5; + +# line 597 "core/core2.pyx" + int __pyx_t_6; + +# line 597 "core/core2.pyx" + int __pyx_t_7; + + /* "core/core2.pyx":600 + * cdef int i, j + * + * if size == 1: # <<<<<<<<<<<<<< + * return leaves + * + */ + +# line 600 "core/core2.pyx" + __pyx_t_1 = ((__pyx_v_size == 1) != 0); + +# line 600 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":601 + * + * if size == 1: + * return leaves # <<<<<<<<<<<<<< + * + * cdef BvhNodeBox * box = self.pop_box() + */ + +# line 601 "core/core2.pyx" + __pyx_r = ((union BvhNode *)__pyx_v_leaves); + +# line 601 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":600 + * cdef int i, j + * + * if size == 1: # <<<<<<<<<<<<<< + * return leaves + * + */ + +# line 600 "core/core2.pyx" + } + + /* "core/core2.pyx":603 + * return leaves + * + * cdef BvhNodeBox * box = self.pop_box() # <<<<<<<<<<<<<< + * + * for i in range(size): + */ + +# line 603 "core/core2.pyx" + __pyx_v_box = __pyx_f_14softwrap_core2_3BVH_pop_box(__pyx_v_self); + + /* "core/core2.pyx":605 + * cdef BvhNodeBox * box = self.pop_box() + * + * for i in range(size): # <<<<<<<<<<<<<< + * for j in range(3): + * box.expand(self.mesh.tri_vert(leaves[i].index, j)) + */ + +# line 605 "core/core2.pyx" + __pyx_t_2 = __pyx_v_size; + +# line 605 "core/core2.pyx" + __pyx_t_3 = __pyx_t_2; + +# line 605 "core/core2.pyx" + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + +# line 605 "core/core2.pyx" + __pyx_v_i = __pyx_t_4; + + /* "core/core2.pyx":606 + * + * for i in range(size): + * for j in range(3): # <<<<<<<<<<<<<< + * box.expand(self.mesh.tri_vert(leaves[i].index, j)) + * + */ + +# line 606 "core/core2.pyx" + for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { + +# line 606 "core/core2.pyx" + __pyx_v_j = __pyx_t_5; + + /* "core/core2.pyx":607 + * for i in range(size): + * for j in range(3): + * box.expand(self.mesh.tri_vert(leaves[i].index, j)) # <<<<<<<<<<<<<< + * + * cdef vec3 median = (box.max + box.min) * 0.5 + */ + +# line 607 "core/core2.pyx" + __pyx_v_box->expand(__pyx_f_14softwrap_core2_4Mesh_tri_vert(__pyx_v_self->mesh, (__pyx_v_leaves[__pyx_v_i]).index, __pyx_v_j)); + +# line 607 "core/core2.pyx" + } + +# line 607 "core/core2.pyx" + } + + /* "core/core2.pyx":609 + * box.expand(self.mesh.tri_vert(leaves[i].index, j)) + * + * cdef vec3 median = (box.max + box.min) * 0.5 # <<<<<<<<<<<<<< + * + * cdef int axis = box.major_axis() + */ + +# line 609 "core/core2.pyx" + __pyx_v_median = ((__pyx_v_box->max + __pyx_v_box->min) * 0.5); + + /* "core/core2.pyx":611 + * cdef vec3 median = (box.max + box.min) * 0.5 + * + * cdef int axis = box.major_axis() # <<<<<<<<<<<<<< + * box.set_split_axis(axis) + * box.split_pos = median.v[axis] + */ + +# line 611 "core/core2.pyx" + __pyx_v_axis = __pyx_v_box->major_axis(); + + /* "core/core2.pyx":612 + * + * cdef int axis = box.major_axis() + * box.set_split_axis(axis) # <<<<<<<<<<<<<< + * box.split_pos = median.v[axis] + * + */ + +# line 612 "core/core2.pyx" + __pyx_v_box->set_split_axis(__pyx_v_axis); + + /* "core/core2.pyx":613 + * cdef int axis = box.major_axis() + * box.set_split_axis(axis) + * box.split_pos = median.v[axis] # <<<<<<<<<<<<<< + * + * j = 0 + */ + +# line 613 "core/core2.pyx" + __pyx_v_box->split_pos = (__pyx_v_median.v[__pyx_v_axis]); + + /* "core/core2.pyx":615 + * box.split_pos = median.v[axis] + * + * j = 0 # <<<<<<<<<<<<<< + * for i in range(size): + * if self.mesh.centroids[leaves[i].index].v[axis] < median.v[axis]: + */ + +# line 615 "core/core2.pyx" + __pyx_v_j = 0; + + /* "core/core2.pyx":616 + * + * j = 0 + * for i in range(size): # <<<<<<<<<<<<<< + * if self.mesh.centroids[leaves[i].index].v[axis] < median.v[axis]: + * leaves[i].index, leaves[j].index = leaves[j].index, leaves[i].index + */ + +# line 616 "core/core2.pyx" + __pyx_t_2 = __pyx_v_size; + +# line 616 "core/core2.pyx" + __pyx_t_3 = __pyx_t_2; + +# line 616 "core/core2.pyx" + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + +# line 616 "core/core2.pyx" + __pyx_v_i = __pyx_t_4; + + /* "core/core2.pyx":617 + * j = 0 + * for i in range(size): + * if self.mesh.centroids[leaves[i].index].v[axis] < median.v[axis]: # <<<<<<<<<<<<<< + * leaves[i].index, leaves[j].index = leaves[j].index, leaves[i].index + * j += 1 + */ + +# line 617 "core/core2.pyx" + __pyx_t_1 = ((((__pyx_v_self->mesh->centroids[(__pyx_v_leaves[__pyx_v_i]).index]).v[__pyx_v_axis]) < (__pyx_v_median.v[__pyx_v_axis])) != 0); + +# line 617 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":618 + * for i in range(size): + * if self.mesh.centroids[leaves[i].index].v[axis] < median.v[axis]: + * leaves[i].index, leaves[j].index = leaves[j].index, leaves[i].index # <<<<<<<<<<<<<< + * j += 1 + * + */ + +# line 618 "core/core2.pyx" + __pyx_t_5 = (__pyx_v_leaves[__pyx_v_j]).index; + +# line 618 "core/core2.pyx" + __pyx_t_6 = (__pyx_v_leaves[__pyx_v_i]).index; + +# line 618 "core/core2.pyx" + (__pyx_v_leaves[__pyx_v_i]).index = __pyx_t_5; + +# line 618 "core/core2.pyx" + (__pyx_v_leaves[__pyx_v_j]).index = __pyx_t_6; + + /* "core/core2.pyx":619 + * if self.mesh.centroids[leaves[i].index].v[axis] < median.v[axis]: + * leaves[i].index, leaves[j].index = leaves[j].index, leaves[i].index + * j += 1 # <<<<<<<<<<<<<< + * + * if j == 0 or j == size: + */ + +# line 619 "core/core2.pyx" + __pyx_v_j = (__pyx_v_j + 1); + + /* "core/core2.pyx":617 + * j = 0 + * for i in range(size): + * if self.mesh.centroids[leaves[i].index].v[axis] < median.v[axis]: # <<<<<<<<<<<<<< + * leaves[i].index, leaves[j].index = leaves[j].index, leaves[i].index + * j += 1 + */ + +# line 617 "core/core2.pyx" + } + +# line 617 "core/core2.pyx" + } + + /* "core/core2.pyx":621 + * j += 1 + * + * if j == 0 or j == size: # <<<<<<<<<<<<<< + * j = size // 2 + * + */ + +# line 621 "core/core2.pyx" + __pyx_t_7 = ((__pyx_v_j == 0) != 0); + +# line 621 "core/core2.pyx" + if (!__pyx_t_7) { + +# line 621 "core/core2.pyx" + } else { + +# line 621 "core/core2.pyx" + __pyx_t_1 = __pyx_t_7; + +# line 621 "core/core2.pyx" + goto __pyx_L12_bool_binop_done; + +# line 621 "core/core2.pyx" + } + +# line 621 "core/core2.pyx" + __pyx_t_7 = ((__pyx_v_j == __pyx_v_size) != 0); + +# line 621 "core/core2.pyx" + __pyx_t_1 = __pyx_t_7; + +# line 621 "core/core2.pyx" + __pyx_L12_bool_binop_done:; + +# line 621 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":622 + * + * if j == 0 or j == size: + * j = size // 2 # <<<<<<<<<<<<<< + * + * box.nodes[0] = self.build_tree(leaves, j) + */ + +# line 622 "core/core2.pyx" + __pyx_v_j = (__pyx_v_size / 2); + + /* "core/core2.pyx":621 + * j += 1 + * + * if j == 0 or j == size: # <<<<<<<<<<<<<< + * j = size // 2 + * + */ + +# line 621 "core/core2.pyx" + } + + /* "core/core2.pyx":624 + * j = size // 2 + * + * box.nodes[0] = self.build_tree(leaves, j) # <<<<<<<<<<<<<< + * box.nodes[1] = self.build_tree(&leaves[j], size - j) + * return box + */ + +# line 624 "core/core2.pyx" + (__pyx_v_box->nodes[0]) = __pyx_f_14softwrap_core2_3BVH_build_tree(__pyx_v_self, __pyx_v_leaves, __pyx_v_j); + + /* "core/core2.pyx":625 + * + * box.nodes[0] = self.build_tree(leaves, j) + * box.nodes[1] = self.build_tree(&leaves[j], size - j) # <<<<<<<<<<<<<< + * return box + * + */ + +# line 625 "core/core2.pyx" + (__pyx_v_box->nodes[1]) = __pyx_f_14softwrap_core2_3BVH_build_tree(__pyx_v_self, (&(__pyx_v_leaves[__pyx_v_j])), (__pyx_v_size - __pyx_v_j)); + + /* "core/core2.pyx":626 + * box.nodes[0] = self.build_tree(leaves, j) + * box.nodes[1] = self.build_tree(&leaves[j], size - j) + * return box # <<<<<<<<<<<<<< + * + * def find_nearest(self, _p): + */ + +# line 626 "core/core2.pyx" + __pyx_r = ((union BvhNode *)__pyx_v_box); + +# line 626 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":597 + * return & self.boxes[self.free_box_idx] + * + * cdef BvhNode* build_tree(self, BvhNodeLeaf* leaves, int size) nogil: # <<<<<<<<<<<<<< + * cdef int i, j + * + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "core/core2.pyx":628 + * return box + * + * def find_nearest(self, _p): # <<<<<<<<<<<<<< + * cdef vec3 p + * p.v = _p + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_3BVH_5find_nearest(PyObject *__pyx_v_self, PyObject *__pyx_v__p); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_3BVH_5find_nearest(PyObject *__pyx_v_self, PyObject *__pyx_v__p) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("find_nearest (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_3BVH_4find_nearest(((struct __pyx_obj_14softwrap_core2_BVH *)__pyx_v_self), ((PyObject *)__pyx_v__p)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_3BVH_4find_nearest(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, PyObject *__pyx_v__p) { + vec3 __pyx_v_p; + struct BvhNearestResult __pyx_v_result; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + float __pyx_t_1[3]; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("find_nearest", 0); + + /* "core/core2.pyx":630 + * def find_nearest(self, _p): + * cdef vec3 p + * p.v = _p # <<<<<<<<<<<<<< + * cdef BvhNearestResult result = self._find_nearest(p) + * return (result.point.v, result.tri_index, result.distance) + */ + +# line 630 "core/core2.pyx" + if (unlikely(__Pyx_carray_from_py_float(__pyx_v__p, __pyx_t_1, 3) < 0)) __PYX_ERR(0, 630, __pyx_L1_error) + +# line 630 "core/core2.pyx" + memcpy(&(__pyx_v_p.v[0]), __pyx_t_1, sizeof(__pyx_v_p.v[0]) * (3)); + + /* "core/core2.pyx":631 + * cdef vec3 p + * p.v = _p + * cdef BvhNearestResult result = self._find_nearest(p) # <<<<<<<<<<<<<< + * return (result.point.v, result.tri_index, result.distance) + * + */ + +# line 631 "core/core2.pyx" + __pyx_v_result = __pyx_f_14softwrap_core2_3BVH__find_nearest(__pyx_v_self, __pyx_v_p); + + /* "core/core2.pyx":632 + * p.v = _p + * cdef BvhNearestResult result = self._find_nearest(p) + * return (result.point.v, result.tri_index, result.distance) # <<<<<<<<<<<<<< + * + * cdef inline BvhNearestResult _find_nearest(self, vec3 p) nogil: + */ + +# line 632 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 632 "core/core2.pyx" + __pyx_t_2 = __Pyx_carray_to_py_float(__pyx_v_result.point.v, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 632, __pyx_L1_error) + +# line 632 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 632 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_result.tri_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 632, __pyx_L1_error) + +# line 632 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 632 "core/core2.pyx" + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_result.distance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error) + +# line 632 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 632 "core/core2.pyx" + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 632, __pyx_L1_error) + +# line 632 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_5); + +# line 632 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_2); + +# line 632 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + +# line 632 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_3); + +# line 632 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + +# line 632 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_4); + +# line 632 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + +# line 632 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 632 "core/core2.pyx" + __pyx_t_3 = 0; + +# line 632 "core/core2.pyx" + __pyx_t_4 = 0; + +# line 632 "core/core2.pyx" + __pyx_r = __pyx_t_5; + +# line 632 "core/core2.pyx" + __pyx_t_5 = 0; + +# line 632 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":628 + * return box + * + * def find_nearest(self, _p): # <<<<<<<<<<<<<< + * cdef vec3 p + * p.v = _p + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("softwrap_core2.BVH.find_nearest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":634 + * return (result.point.v, result.tri_index, result.distance) + * + * cdef inline BvhNearestResult _find_nearest(self, vec3 p) nogil: # <<<<<<<<<<<<<< + * cdef BvhNearestResult result + * result.distance = INFINITY + */ + + +# line 634 "core/core2.pyx" +static CYTHON_INLINE struct BvhNearestResult __pyx_f_14softwrap_core2_3BVH__find_nearest(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, vec3 __pyx_v_p) { + +# line 634 "core/core2.pyx" + struct BvhNearestResult __pyx_v_result; + +# line 634 "core/core2.pyx" + struct BvhNearestResult __pyx_r; + + /* "core/core2.pyx":636 + * cdef inline BvhNearestResult _find_nearest(self, vec3 p) nogil: + * cdef BvhNearestResult result + * result.distance = INFINITY # <<<<<<<<<<<<<< + * self.find_nearest_recursive( & p, & result, self.root) + * return result + */ + +# line 636 "core/core2.pyx" + __pyx_v_result.distance = INFINITY; + + /* "core/core2.pyx":637 + * cdef BvhNearestResult result + * result.distance = INFINITY + * self.find_nearest_recursive( & p, & result, self.root) # <<<<<<<<<<<<<< + * return result + * + */ + +# line 637 "core/core2.pyx" + __pyx_f_14softwrap_core2_3BVH_find_nearest_recursive(__pyx_v_self, (&__pyx_v_p), (&__pyx_v_result), __pyx_v_self->root); + + /* "core/core2.pyx":638 + * result.distance = INFINITY + * self.find_nearest_recursive( & p, & result, self.root) + * return result # <<<<<<<<<<<<<< + * + * cdef void find_nearest_recursive(self, vec3* p, BvhNearestResult* out, BvhNode* node) nogil: + */ + +# line 638 "core/core2.pyx" + __pyx_r = __pyx_v_result; + +# line 638 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":634 + * return (result.point.v, result.tri_index, result.distance) + * + * cdef inline BvhNearestResult _find_nearest(self, vec3 p) nogil: # <<<<<<<<<<<<<< + * cdef BvhNearestResult result + * result.distance = INFINITY + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "core/core2.pyx":640 + * return result + * + * cdef void find_nearest_recursive(self, vec3* p, BvhNearestResult* out, BvhNode* node) nogil: # <<<<<<<<<<<<<< + * cdef vec3 closest + * cdef int i, axis + */ + + +# line 640 "core/core2.pyx" +static void __pyx_f_14softwrap_core2_3BVH_find_nearest_recursive(struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, vec3 *__pyx_v_p, struct BvhNearestResult *__pyx_v_out, union BvhNode *__pyx_v_node) { + +# line 640 "core/core2.pyx" + vec3 __pyx_v_closest; + +# line 640 "core/core2.pyx" + int __pyx_v_i; + +# line 640 "core/core2.pyx" + int __pyx_v_axis; + +# line 640 "core/core2.pyx" + float __pyx_v_dist; + +# line 640 "core/core2.pyx" + int __pyx_t_1; + +# line 640 "core/core2.pyx" + int __pyx_t_2; + + /* "core/core2.pyx":644 + * cdef int i, axis + * cdef float dist + * if node.is_leaf(): # <<<<<<<<<<<<<< + * i = (< BvhNodeLeaf*>node).index + * closest = project_point_triangle(self.mesh.tri_vert_ptr(i, 0)[0], + */ + +# line 644 "core/core2.pyx" + __pyx_t_1 = (__pyx_v_node->is_leaf() != 0); + +# line 644 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":645 + * cdef float dist + * if node.is_leaf(): + * i = (< BvhNodeLeaf*>node).index # <<<<<<<<<<<<<< + * closest = project_point_triangle(self.mesh.tri_vert_ptr(i, 0)[0], + * self.mesh.tri_vert_ptr(i, 1)[0], + */ + +# line 645 "core/core2.pyx" + __pyx_t_2 = ((BvhNodeLeaf *)__pyx_v_node)->index; + +# line 645 "core/core2.pyx" + __pyx_v_i = __pyx_t_2; + + /* "core/core2.pyx":646 + * if node.is_leaf(): + * i = (< BvhNodeLeaf*>node).index + * closest = project_point_triangle(self.mesh.tri_vert_ptr(i, 0)[0], # <<<<<<<<<<<<<< + * self.mesh.tri_vert_ptr(i, 1)[0], + * self.mesh.tri_vert_ptr(i, 2)[0], + */ + +# line 646 "core/core2.pyx" + __pyx_v_closest = project_point_triangle((__pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr(__pyx_v_self->mesh, __pyx_v_i, 0)[0]), (__pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr(__pyx_v_self->mesh, __pyx_v_i, 1)[0]), (__pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr(__pyx_v_self->mesh, __pyx_v_i, 2)[0]), (__pyx_v_self->mesh->face_normals[__pyx_v_i]), (__pyx_v_p[0])); + + /* "core/core2.pyx":652 + * p[0]) + * + * dist = (closest - p[0]).len_sqr() # <<<<<<<<<<<<<< + * if dist < out.distance: + * out.point = closest + */ + +# line 652 "core/core2.pyx" + __pyx_v_dist = (__pyx_v_closest - (__pyx_v_p[0])).len_sqr(); + + /* "core/core2.pyx":653 + * + * dist = (closest - p[0]).len_sqr() + * if dist < out.distance: # <<<<<<<<<<<<<< + * out.point = closest + * out.tri_index = i + */ + +# line 653 "core/core2.pyx" + __pyx_t_1 = ((__pyx_v_dist < __pyx_v_out->distance) != 0); + +# line 653 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":654 + * dist = (closest - p[0]).len_sqr() + * if dist < out.distance: + * out.point = closest # <<<<<<<<<<<<<< + * out.tri_index = i + * out.distance = dist + */ + +# line 654 "core/core2.pyx" + __pyx_v_out->point = __pyx_v_closest; + + /* "core/core2.pyx":655 + * if dist < out.distance: + * out.point = closest + * out.tri_index = i # <<<<<<<<<<<<<< + * out.distance = dist + * + */ + +# line 655 "core/core2.pyx" + __pyx_v_out->tri_index = __pyx_v_i; + + /* "core/core2.pyx":656 + * out.point = closest + * out.tri_index = i + * out.distance = dist # <<<<<<<<<<<<<< + * + * else: + */ + +# line 656 "core/core2.pyx" + __pyx_v_out->distance = __pyx_v_dist; + + /* "core/core2.pyx":653 + * + * dist = (closest - p[0]).len_sqr() + * if dist < out.distance: # <<<<<<<<<<<<<< + * out.point = closest + * out.tri_index = i + */ + +# line 653 "core/core2.pyx" + } + + /* "core/core2.pyx":644 + * cdef int i, axis + * cdef float dist + * if node.is_leaf(): # <<<<<<<<<<<<<< + * i = (< BvhNodeLeaf*>node).index + * closest = project_point_triangle(self.mesh.tri_vert_ptr(i, 0)[0], + */ + +# line 644 "core/core2.pyx" + goto __pyx_L3; + +# line 644 "core/core2.pyx" + } + + /* "core/core2.pyx":659 + * + * else: + * dist = node.box.box_distance_sqr(p[0]) # <<<<<<<<<<<<<< + * if dist < out.distance: + * # if not node.box.nodes[0].is_leaf(): + */ + /*else*/ { + __pyx_v_dist = __pyx_v_node->box.box_distance_sqr((__pyx_v_p[0])); + + /* "core/core2.pyx":660 + * else: + * dist = node.box.box_distance_sqr(p[0]) + * if dist < out.distance: # <<<<<<<<<<<<<< + * # if not node.box.nodes[0].is_leaf(): + * # self.find_nearest_recursive(p, out, node.box.nodes[0]) + */ + +# line 660 "core/core2.pyx" + __pyx_t_1 = ((__pyx_v_dist < __pyx_v_out->distance) != 0); + +# line 660 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":675 + * # self.find_nearest_recursive(p, out, node.box.nodes[1]) + * # return + * axis = node.box.get_split_axis() # <<<<<<<<<<<<<< + * if node.box.split_pos > p.v[axis]: + * self.find_nearest_recursive(p, out, node.box.nodes[0]) + */ + +# line 675 "core/core2.pyx" + __pyx_v_axis = __pyx_v_node->box.get_split_axis(); + + /* "core/core2.pyx":676 + * # return + * axis = node.box.get_split_axis() + * if node.box.split_pos > p.v[axis]: # <<<<<<<<<<<<<< + * self.find_nearest_recursive(p, out, node.box.nodes[0]) + * self.find_nearest_recursive(p, out, node.box.nodes[1]) + */ + +# line 676 "core/core2.pyx" + __pyx_t_1 = ((__pyx_v_node->box.split_pos > (__pyx_v_p->v[__pyx_v_axis])) != 0); + +# line 676 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":677 + * axis = node.box.get_split_axis() + * if node.box.split_pos > p.v[axis]: + * self.find_nearest_recursive(p, out, node.box.nodes[0]) # <<<<<<<<<<<<<< + * self.find_nearest_recursive(p, out, node.box.nodes[1]) + * return + */ + +# line 677 "core/core2.pyx" + __pyx_f_14softwrap_core2_3BVH_find_nearest_recursive(__pyx_v_self, __pyx_v_p, __pyx_v_out, (__pyx_v_node->box.nodes[0])); + + /* "core/core2.pyx":678 + * if node.box.split_pos > p.v[axis]: + * self.find_nearest_recursive(p, out, node.box.nodes[0]) + * self.find_nearest_recursive(p, out, node.box.nodes[1]) # <<<<<<<<<<<<<< + * return + * self.find_nearest_recursive(p, out, node.box.nodes[1]) + */ + +# line 678 "core/core2.pyx" + __pyx_f_14softwrap_core2_3BVH_find_nearest_recursive(__pyx_v_self, __pyx_v_p, __pyx_v_out, (__pyx_v_node->box.nodes[1])); + + /* "core/core2.pyx":679 + * self.find_nearest_recursive(p, out, node.box.nodes[0]) + * self.find_nearest_recursive(p, out, node.box.nodes[1]) + * return # <<<<<<<<<<<<<< + * self.find_nearest_recursive(p, out, node.box.nodes[1]) + * self.find_nearest_recursive(p, out, node.box.nodes[0]) + */ + +# line 679 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":676 + * # return + * axis = node.box.get_split_axis() + * if node.box.split_pos > p.v[axis]: # <<<<<<<<<<<<<< + * self.find_nearest_recursive(p, out, node.box.nodes[0]) + * self.find_nearest_recursive(p, out, node.box.nodes[1]) + */ + +# line 676 "core/core2.pyx" + } + + /* "core/core2.pyx":680 + * self.find_nearest_recursive(p, out, node.box.nodes[1]) + * return + * self.find_nearest_recursive(p, out, node.box.nodes[1]) # <<<<<<<<<<<<<< + * self.find_nearest_recursive(p, out, node.box.nodes[0]) + * + */ + +# line 680 "core/core2.pyx" + __pyx_f_14softwrap_core2_3BVH_find_nearest_recursive(__pyx_v_self, __pyx_v_p, __pyx_v_out, (__pyx_v_node->box.nodes[1])); + + /* "core/core2.pyx":681 + * return + * self.find_nearest_recursive(p, out, node.box.nodes[1]) + * self.find_nearest_recursive(p, out, node.box.nodes[0]) # <<<<<<<<<<<<<< + * + * + */ + +# line 681 "core/core2.pyx" + __pyx_f_14softwrap_core2_3BVH_find_nearest_recursive(__pyx_v_self, __pyx_v_p, __pyx_v_out, (__pyx_v_node->box.nodes[0])); + + /* "core/core2.pyx":660 + * else: + * dist = node.box.box_distance_sqr(p[0]) + * if dist < out.distance: # <<<<<<<<<<<<<< + * # if not node.box.nodes[0].is_leaf(): + * # self.find_nearest_recursive(p, out, node.box.nodes[0]) + */ + +# line 660 "core/core2.pyx" + } + +# line 660 "core/core2.pyx" + } + +# line 660 "core/core2.pyx" + __pyx_L3:; + + /* "core/core2.pyx":640 + * return result + * + * cdef void find_nearest_recursive(self, vec3* p, BvhNearestResult* out, BvhNode* node) nogil: # <<<<<<<<<<<<<< + * cdef vec3 closest + * cdef int i, axis + */ + + /* function exit code */ + __pyx_L0:; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_3BVH_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_3BVH_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_3BVH_6__reduce_cython__(((struct __pyx_obj_14softwrap_core2_BVH *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_3BVH_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.BVH.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_3BVH_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_3BVH_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_3BVH_8__setstate_cython__(((struct __pyx_obj_14softwrap_core2_BVH *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_3BVH_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.BVH.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":717 + * cdef readonly int index + * + * def __cinit__(self, SpringLinks springs, int index): # <<<<<<<<<<<<<< + * self.springs = springs + * if index < 0 or index >= springs.engine.n_verts: + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_9LinkProbe_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_9LinkProbe_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_springs = 0; + int __pyx_v_index; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_springs,&__pyx_n_s_index,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_springs)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 717, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 717, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_springs = ((struct __pyx_obj_14softwrap_core2_SpringLinks *)values[0]); + __pyx_v_index = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 717, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.LinkProbe.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_springs), __pyx_ptype_14softwrap_core2_SpringLinks, 1, "springs", 0))) __PYX_ERR(0, 717, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_9LinkProbe___cinit__(((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_v_self), __pyx_v_springs, __pyx_v_index); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_9LinkProbe___cinit__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_springs, int __pyx_v_index) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "core/core2.pyx":718 + * + * def __cinit__(self, SpringLinks springs, int index): + * self.springs = springs # <<<<<<<<<<<<<< + * if index < 0 or index >= springs.engine.n_verts: + * raise IndexError + */ + +# line 718 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_springs)); + +# line 718 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_springs)); + +# line 718 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->springs); + +# line 718 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->springs)); + +# line 718 "core/core2.pyx" + __pyx_v_self->springs = __pyx_v_springs; + + /* "core/core2.pyx":719 + * def __cinit__(self, SpringLinks springs, int index): + * self.springs = springs + * if index < 0 or index >= springs.engine.n_verts: # <<<<<<<<<<<<<< + * raise IndexError + * + */ + +# line 719 "core/core2.pyx" + __pyx_t_2 = ((__pyx_v_index < 0) != 0); + +# line 719 "core/core2.pyx" + if (!__pyx_t_2) { + +# line 719 "core/core2.pyx" + } else { + +# line 719 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 719 "core/core2.pyx" + goto __pyx_L4_bool_binop_done; + +# line 719 "core/core2.pyx" + } + +# line 719 "core/core2.pyx" + __pyx_t_2 = ((__pyx_v_index >= __pyx_v_springs->engine->n_verts) != 0); + +# line 719 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 719 "core/core2.pyx" + __pyx_L4_bool_binop_done:; + +# line 719 "core/core2.pyx" + if (unlikely(__pyx_t_1)) { + + /* "core/core2.pyx":720 + * self.springs = springs + * if index < 0 or index >= springs.engine.n_verts: + * raise IndexError # <<<<<<<<<<<<<< + * + * self.index = index + */ + +# line 720 "core/core2.pyx" + __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); + +# line 720 "core/core2.pyx" + __PYX_ERR(0, 720, __pyx_L1_error) + + /* "core/core2.pyx":719 + * def __cinit__(self, SpringLinks springs, int index): + * self.springs = springs + * if index < 0 or index >= springs.engine.n_verts: # <<<<<<<<<<<<<< + * raise IndexError + * + */ + +# line 719 "core/core2.pyx" + } + + /* "core/core2.pyx":722 + * raise IndexError + * + * self.index = index # <<<<<<<<<<<<<< + * self.halflinks = springs.links[index] + * + */ + +# line 722 "core/core2.pyx" + __pyx_v_self->index = __pyx_v_index; + + /* "core/core2.pyx":723 + * + * self.index = index + * self.halflinks = springs.links[index] # <<<<<<<<<<<<<< + * + * def __getitem__(self, int link_index): + */ + +# line 723 "core/core2.pyx" + __pyx_v_self->halflinks = (__pyx_v_springs->links[__pyx_v_index]); + + /* "core/core2.pyx":717 + * cdef readonly int index + * + * def __cinit__(self, SpringLinks springs, int index): # <<<<<<<<<<<<<< + * self.springs = springs + * if index < 0 or index >= springs.engine.n_verts: + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("softwrap_core2.LinkProbe.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":725 + * self.halflinks = springs.links[index] + * + * def __getitem__(self, int link_index): # <<<<<<<<<<<<<< + * if link_index < 0 or link_index >= self.halflinks.n: + * raise IndexError + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_link_index); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_link_index) { + int __pyx_v_link_index; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + assert(__pyx_arg_link_index); { + __pyx_v_link_index = __Pyx_PyInt_As_int(__pyx_arg_link_index); if (unlikely((__pyx_v_link_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.LinkProbe.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_9LinkProbe_2__getitem__(((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_v_self), ((int)__pyx_v_link_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_2__getitem__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self, int __pyx_v_link_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "core/core2.pyx":726 + * + * def __getitem__(self, int link_index): + * if link_index < 0 or link_index >= self.halflinks.n: # <<<<<<<<<<<<<< + * raise IndexError + * return self.halflinks.half_links[link_index].a + */ + +# line 726 "core/core2.pyx" + __pyx_t_2 = ((__pyx_v_link_index < 0) != 0); + +# line 726 "core/core2.pyx" + if (!__pyx_t_2) { + +# line 726 "core/core2.pyx" + } else { + +# line 726 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 726 "core/core2.pyx" + goto __pyx_L4_bool_binop_done; + +# line 726 "core/core2.pyx" + } + +# line 726 "core/core2.pyx" + __pyx_t_2 = ((__pyx_v_link_index >= __pyx_v_self->halflinks->n) != 0); + +# line 726 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 726 "core/core2.pyx" + __pyx_L4_bool_binop_done:; + +# line 726 "core/core2.pyx" + if (unlikely(__pyx_t_1)) { + + /* "core/core2.pyx":727 + * def __getitem__(self, int link_index): + * if link_index < 0 or link_index >= self.halflinks.n: + * raise IndexError # <<<<<<<<<<<<<< + * return self.halflinks.half_links[link_index].a + * + */ + +# line 727 "core/core2.pyx" + __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); + +# line 727 "core/core2.pyx" + __PYX_ERR(0, 727, __pyx_L1_error) + + /* "core/core2.pyx":726 + * + * def __getitem__(self, int link_index): + * if link_index < 0 or link_index >= self.halflinks.n: # <<<<<<<<<<<<<< + * raise IndexError + * return self.halflinks.half_links[link_index].a + */ + +# line 726 "core/core2.pyx" + } + + /* "core/core2.pyx":728 + * if link_index < 0 or link_index >= self.halflinks.n: + * raise IndexError + * return self.halflinks.half_links[link_index].a # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + +# line 728 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 728 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_self->halflinks->half_links[__pyx_v_link_index]).a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 728, __pyx_L1_error) + +# line 728 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 728 "core/core2.pyx" + __pyx_r = __pyx_t_3; + +# line 728 "core/core2.pyx" + __pyx_t_3 = 0; + +# line 728 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":725 + * self.halflinks = springs.links[index] + * + * def __getitem__(self, int link_index): # <<<<<<<<<<<<<< + * if link_index < 0 or link_index >= self.halflinks.n: + * raise IndexError + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("softwrap_core2.LinkProbe.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":730 + * return self.halflinks.half_links[link_index].a + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.halflinks.n + * + */ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_14softwrap_core2_9LinkProbe_5__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_14softwrap_core2_9LinkProbe_5__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_9LinkProbe_4__len__(((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_14softwrap_core2_9LinkProbe_4__len__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "core/core2.pyx":731 + * + * def __len__(self): + * return self.halflinks.n # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + +# line 731 "core/core2.pyx" + __pyx_r = __pyx_v_self->halflinks->n; + +# line 731 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":730 + * return self.halflinks.half_links[link_index].a + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.halflinks.n + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_14softwrap_core2_9LinkProbe_8generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "core/core2.pyx":733 + * return self.halflinks.n + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.halflinks.n): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_7__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_7__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_9LinkProbe_6__iter__(((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_6__iter__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self) { + struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + __pyx_cur_scope = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *)__pyx_tp_new_14softwrap_core2___pyx_scope_struct____iter__(__pyx_ptype_14softwrap_core2___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 733, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_14softwrap_core2_9LinkProbe_8generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_LinkProbe___iter, __pyx_n_s_softwrap_core2); if (unlikely(!gen)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("softwrap_core2.LinkProbe.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_14softwrap_core2_9LinkProbe_8generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 733, __pyx_L1_error) + + /* "core/core2.pyx":735 + * def __iter__(self): + * cdef int i + * for i in range(self.halflinks.n): # <<<<<<<<<<<<<< + * yield self.halflinks.half_links[i].a + * + */ + +# line 735 "core/core2.pyx" + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->halflinks->n; + +# line 735 "core/core2.pyx" + __pyx_t_2 = __pyx_t_1; + +# line 735 "core/core2.pyx" + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + +# line 735 "core/core2.pyx" + __pyx_cur_scope->__pyx_v_i = __pyx_t_3; + + /* "core/core2.pyx":736 + * cdef int i + * for i in range(self.halflinks.n): + * yield self.halflinks.half_links[i].a # <<<<<<<<<<<<<< + * + * @property + */ + +# line 736 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_cur_scope->__pyx_v_self->halflinks->half_links[__pyx_cur_scope->__pyx_v_i]).a); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 736, __pyx_L1_error) + +# line 736 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 736 "core/core2.pyx" + __pyx_r = __pyx_t_4; + +# line 736 "core/core2.pyx" + __pyx_t_4 = 0; + +# line 736 "core/core2.pyx" + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + +# line 736 "core/core2.pyx" + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + +# line 736 "core/core2.pyx" + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + +# line 736 "core/core2.pyx" + __Pyx_XGIVEREF(__pyx_r); + +# line 736 "core/core2.pyx" + __Pyx_RefNannyFinishContext(); + +# line 736 "core/core2.pyx" + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 736, __pyx_L1_error) + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "core/core2.pyx":733 + * return self.halflinks.n + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.halflinks.n): + */ + + /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":739 + * + * @property + * def avg_radius(self): # <<<<<<<<<<<<<< + * cdef int i + * cdef float r = 0 + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_10avg_radius_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_10avg_radius_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_9LinkProbe_10avg_radius___get__(((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_10avg_radius___get__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self) { + int __pyx_v_i; + float __pyx_v_r; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "core/core2.pyx":741 + * def avg_radius(self): + * cdef int i + * cdef float r = 0 # <<<<<<<<<<<<<< + * for i in range(self.halflinks.n): + * r += self.halflinks.half_links[i].original_length + */ + +# line 741 "core/core2.pyx" + __pyx_v_r = 0.0; + + /* "core/core2.pyx":742 + * cdef int i + * cdef float r = 0 + * for i in range(self.halflinks.n): # <<<<<<<<<<<<<< + * r += self.halflinks.half_links[i].original_length + * + */ + +# line 742 "core/core2.pyx" + __pyx_t_1 = __pyx_v_self->halflinks->n; + +# line 742 "core/core2.pyx" + __pyx_t_2 = __pyx_t_1; + +# line 742 "core/core2.pyx" + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + +# line 742 "core/core2.pyx" + __pyx_v_i = __pyx_t_3; + + /* "core/core2.pyx":743 + * cdef float r = 0 + * for i in range(self.halflinks.n): + * r += self.halflinks.half_links[i].original_length # <<<<<<<<<<<<<< + * + * return r / (self.halflinks.n + EPS) + */ + +# line 743 "core/core2.pyx" + __pyx_v_r = (__pyx_v_r + (__pyx_v_self->halflinks->half_links[__pyx_v_i]).original_length); + +# line 743 "core/core2.pyx" + } + + /* "core/core2.pyx":745 + * r += self.halflinks.half_links[i].original_length + * + * return r / (self.halflinks.n + EPS) # <<<<<<<<<<<<<< + * + * cdef class SpringLinks: + */ + +# line 745 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 745 "core/core2.pyx" + __pyx_t_4 = PyFloat_FromDouble((__pyx_v_r / (__pyx_v_self->halflinks->n + EPS))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 745, __pyx_L1_error) + +# line 745 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 745 "core/core2.pyx" + __pyx_r = __pyx_t_4; + +# line 745 "core/core2.pyx" + __pyx_t_4 = 0; + +# line 745 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":739 + * + * @property + * def avg_radius(self): # <<<<<<<<<<<<<< + * cdef int i + * cdef float r = 0 + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.LinkProbe.avg_radius.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":713 + * @cython.final + * cdef class LinkProbe: + * cdef readonly SpringLinks springs # <<<<<<<<<<<<<< + * cdef HalfLinkArr* halflinks + * cdef readonly int index + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_7springs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_7springs_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_9LinkProbe_7springs___get__(((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_7springs___get__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->springs)); + __pyx_r = ((PyObject *)__pyx_v_self->springs); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":715 + * cdef readonly SpringLinks springs + * cdef HalfLinkArr* halflinks + * cdef readonly int index # <<<<<<<<<<<<<< + * + * def __cinit__(self, SpringLinks springs, int index): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_5index_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_5index_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_9LinkProbe_5index___get__(((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_5index___get__(struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.LinkProbe.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_10__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_10__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_9LinkProbe_9__reduce_cython__(((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_9__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.LinkProbe.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_12__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_9LinkProbe_12__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_9LinkProbe_11__setstate_cython__(((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_9LinkProbe_11__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.LinkProbe.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":754 + * + * @cython.boundscheck(True) + * def __cinit__(self, SpringEngine engine, list links): # <<<<<<<<<<<<<< + * self.engine = engine + * self.links = maelloc(sizeof(HalfLink**) * self.engine.n_verts, __LINE__) + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_11SpringLinks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_11SpringLinks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine = 0; + PyObject *__pyx_v_links = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_engine,&__pyx_n_s_links,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_engine)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_links)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 754, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 754, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)values[0]); + __pyx_v_links = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 754, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringLinks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_engine), __pyx_ptype_14softwrap_core2_SpringEngine, 1, "engine", 0))) __PYX_ERR(0, 754, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_links), (&PyList_Type), 1, "links", 1))) __PYX_ERR(0, 754, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_11SpringLinks___cinit__(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self), __pyx_v_engine, __pyx_v_links); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_11SpringLinks___cinit__(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine, PyObject *__pyx_v_links) { + int __pyx_v_a; + int __pyx_v_b; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_n; + PyObject *__pyx_v_arranged_links = 0; + PyObject *__pyx_v_half_lst = 0; + CYTHON_UNUSED int __pyx_7genexpr__pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + void *__pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "core/core2.pyx":755 + * @cython.boundscheck(True) + * def __cinit__(self, SpringEngine engine, list links): + * self.engine = engine # <<<<<<<<<<<<<< + * self.links = maelloc(sizeof(HalfLink**) * self.engine.n_verts, __LINE__) + * self.links[0] = maelloc(sizeof(HalfLinkArr) * self.engine.n_verts + sizeof(HalfLink) * 2 * len(links), __LINE__) + */ + +# line 755 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_engine)); + +# line 755 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_engine)); + +# line 755 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->engine); + +# line 755 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->engine)); + +# line 755 "core/core2.pyx" + __pyx_v_self->engine = __pyx_v_engine; + + /* "core/core2.pyx":756 + * def __cinit__(self, SpringEngine engine, list links): + * self.engine = engine + * self.links = maelloc(sizeof(HalfLink**) * self.engine.n_verts, __LINE__) # <<<<<<<<<<<<<< + * self.links[0] = maelloc(sizeof(HalfLinkArr) * self.engine.n_verts + sizeof(HalfLink) * 2 * len(links), __LINE__) + * + */ + +# line 756 "core/core2.pyx" + __pyx_t_1 = __pyx_f_14softwrap_core2_maelloc(((sizeof(struct HalfLink **)) * __pyx_v_self->engine->n_verts), __LINE__); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(0, 756, __pyx_L1_error) + +# line 756 "core/core2.pyx" + __pyx_v_self->links = ((struct HalfLinkArr **)__pyx_t_1); + + /* "core/core2.pyx":757 + * self.engine = engine + * self.links = maelloc(sizeof(HalfLink**) * self.engine.n_verts, __LINE__) + * self.links[0] = maelloc(sizeof(HalfLinkArr) * self.engine.n_verts + sizeof(HalfLink) * 2 * len(links), __LINE__) # <<<<<<<<<<<<<< + * + * cdef int a, b, i, j, n + */ + +# line 757 "core/core2.pyx" + if (unlikely(__pyx_v_links == Py_None)) { + +# line 757 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 757 "core/core2.pyx" + __PYX_ERR(0, 757, __pyx_L1_error) + +# line 757 "core/core2.pyx" + } + +# line 757 "core/core2.pyx" + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_links); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 757, __pyx_L1_error) + +# line 757 "core/core2.pyx" + __pyx_t_1 = __pyx_f_14softwrap_core2_maelloc((((sizeof(struct HalfLinkArr)) * __pyx_v_self->engine->n_verts) + (((sizeof(struct HalfLink)) * 2) * __pyx_t_2)), __LINE__); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(0, 757, __pyx_L1_error) + +# line 757 "core/core2.pyx" + (__pyx_v_self->links[0]) = ((struct HalfLinkArr *)__pyx_t_1); + + /* "core/core2.pyx":761 + * cdef int a, b, i, j, n + * + * cdef list arranged_links = [[] for i in range(engine.n_verts)] # <<<<<<<<<<<<<< + * + * for a, b in links: + */ + { /* enter inner scope */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_v_engine->n_verts; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_7genexpr__pyx_v_i = __pyx_t_6; + __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + } /* exit inner scope */ + __pyx_v_arranged_links = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "core/core2.pyx":763 + * cdef list arranged_links = [[] for i in range(engine.n_verts)] + * + * for a, b in links: # <<<<<<<<<<<<<< + * arranged_links[a].append(b) + * arranged_links[b].append(a) + */ + +# line 763 "core/core2.pyx" + if (unlikely(__pyx_v_links == Py_None)) { + +# line 763 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + +# line 763 "core/core2.pyx" + __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + } + +# line 763 "core/core2.pyx" + __pyx_t_3 = __pyx_v_links; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0; + +# line 763 "core/core2.pyx" + for (;;) { + +# line 763 "core/core2.pyx" + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; + +# line 763 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 763 "core/core2.pyx" + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + #else + +# line 763 "core/core2.pyx" + __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 763 "core/core2.pyx" + #endif + +# line 763 "core/core2.pyx" + if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { + +# line 763 "core/core2.pyx" + PyObject* sequence = __pyx_t_7; + +# line 763 "core/core2.pyx" + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + +# line 763 "core/core2.pyx" + if (unlikely(size != 2)) { + +# line 763 "core/core2.pyx" + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + +# line 763 "core/core2.pyx" + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + +# line 763 "core/core2.pyx" + __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + } + +# line 763 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 763 "core/core2.pyx" + if (likely(PyTuple_CheckExact(sequence))) { + +# line 763 "core/core2.pyx" + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + +# line 763 "core/core2.pyx" + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); + +# line 763 "core/core2.pyx" + } else { + +# line 763 "core/core2.pyx" + __pyx_t_8 = PyList_GET_ITEM(sequence, 0); + +# line 763 "core/core2.pyx" + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); + +# line 763 "core/core2.pyx" + } + +# line 763 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_8); + +# line 763 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_9); + +# line 763 "core/core2.pyx" + #else + +# line 763 "core/core2.pyx" + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 763 "core/core2.pyx" + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 763 "core/core2.pyx" + #endif + +# line 763 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 763 "core/core2.pyx" + } else { + +# line 763 "core/core2.pyx" + Py_ssize_t index = -1; + +# line 763 "core/core2.pyx" + __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_10); + +# line 763 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 763 "core/core2.pyx" + __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; + +# line 763 "core/core2.pyx" + index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed; + +# line 763 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 763 "core/core2.pyx" + index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed; + +# line 763 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 763 "core/core2.pyx" + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + __pyx_t_11 = NULL; + +# line 763 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + +# line 763 "core/core2.pyx" + goto __pyx_L8_unpacking_done; + +# line 763 "core/core2.pyx" + __pyx_L7_unpacking_failed:; + +# line 763 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + +# line 763 "core/core2.pyx" + __pyx_t_11 = NULL; + +# line 763 "core/core2.pyx" + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + +# line 763 "core/core2.pyx" + __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + __pyx_L8_unpacking_done:; + +# line 763 "core/core2.pyx" + } + +# line 763 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + +# line 763 "core/core2.pyx" + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error) + +# line 763 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + +# line 763 "core/core2.pyx" + __pyx_v_a = __pyx_t_4; + +# line 763 "core/core2.pyx" + __pyx_v_b = __pyx_t_5; + + /* "core/core2.pyx":764 + * + * for a, b in links: + * arranged_links[a].append(b) # <<<<<<<<<<<<<< + * arranged_links[b].append(a) + * + */ + +# line 764 "core/core2.pyx" + __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_arranged_links, __pyx_v_a, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 764, __pyx_L1_error) + +# line 764 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 764 "core/core2.pyx" + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_b); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 764, __pyx_L1_error) + +# line 764 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 764 "core/core2.pyx" + __pyx_t_12 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 764, __pyx_L1_error) + +# line 764 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 764 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "core/core2.pyx":765 + * for a, b in links: + * arranged_links[a].append(b) + * arranged_links[b].append(a) # <<<<<<<<<<<<<< + * + * cdef list half_lst + */ + +# line 765 "core/core2.pyx" + __pyx_t_9 = __Pyx_GetItemInt_List(__pyx_v_arranged_links, __pyx_v_b, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 765, __pyx_L1_error) + +# line 765 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 765 "core/core2.pyx" + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_a); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 765, __pyx_L1_error) + +# line 765 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 765 "core/core2.pyx" + __pyx_t_12 = __Pyx_PyObject_Append(__pyx_t_9, __pyx_t_7); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 765, __pyx_L1_error) + +# line 765 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + +# line 765 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "core/core2.pyx":763 + * cdef list arranged_links = [[] for i in range(engine.n_verts)] + * + * for a, b in links: # <<<<<<<<<<<<<< + * arranged_links[a].append(b) + * arranged_links[b].append(a) + */ + +# line 763 "core/core2.pyx" + } + +# line 763 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "core/core2.pyx":769 + * cdef list half_lst + * + * for i in range(engine.n_verts): # <<<<<<<<<<<<<< + * half_lst = arranged_links[i] + * n = len(half_lst) + */ + +# line 769 "core/core2.pyx" + __pyx_t_5 = __pyx_v_engine->n_verts; + +# line 769 "core/core2.pyx" + __pyx_t_4 = __pyx_t_5; + +# line 769 "core/core2.pyx" + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_4; __pyx_t_6+=1) { + +# line 769 "core/core2.pyx" + __pyx_v_i = __pyx_t_6; + + /* "core/core2.pyx":770 + * + * for i in range(engine.n_verts): + * half_lst = arranged_links[i] # <<<<<<<<<<<<<< + * n = len(half_lst) + * + */ + +# line 770 "core/core2.pyx" + __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_arranged_links, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error) + +# line 770 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 770 "core/core2.pyx" + if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 770, __pyx_L1_error) + +# line 770 "core/core2.pyx" + __Pyx_XDECREF_SET(__pyx_v_half_lst, ((PyObject*)__pyx_t_3)); + +# line 770 "core/core2.pyx" + __pyx_t_3 = 0; + + /* "core/core2.pyx":771 + * for i in range(engine.n_verts): + * half_lst = arranged_links[i] + * n = len(half_lst) # <<<<<<<<<<<<<< + * + * if i > 0: + */ + +# line 771 "core/core2.pyx" + if (unlikely(__pyx_v_half_lst == Py_None)) { + +# line 771 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 771 "core/core2.pyx" + __PYX_ERR(0, 771, __pyx_L1_error) + +# line 771 "core/core2.pyx" + } + +# line 771 "core/core2.pyx" + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_half_lst); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 771, __pyx_L1_error) + +# line 771 "core/core2.pyx" + __pyx_v_n = __pyx_t_2; + + /* "core/core2.pyx":773 + * n = len(half_lst) + * + * if i > 0: # <<<<<<<<<<<<<< + * self.links[i] = ((self.links[i - 1]) + sizeof(HalfLinkArr) + sizeof(HalfLink) * self.links[i - 1].n) + * + */ + +# line 773 "core/core2.pyx" + __pyx_t_13 = ((__pyx_v_i > 0) != 0); + +# line 773 "core/core2.pyx" + if (__pyx_t_13) { + + /* "core/core2.pyx":774 + * + * if i > 0: + * self.links[i] = ((self.links[i - 1]) + sizeof(HalfLinkArr) + sizeof(HalfLink) * self.links[i - 1].n) # <<<<<<<<<<<<<< + * + * self.links[i].n = n + */ + +# line 774 "core/core2.pyx" + (__pyx_v_self->links[__pyx_v_i]) = ((struct HalfLinkArr *)((((char *)(__pyx_v_self->links[(__pyx_v_i - 1)])) + (sizeof(struct HalfLinkArr))) + ((sizeof(struct HalfLink)) * (__pyx_v_self->links[(__pyx_v_i - 1)])->n))); + + /* "core/core2.pyx":773 + * n = len(half_lst) + * + * if i > 0: # <<<<<<<<<<<<<< + * self.links[i] = ((self.links[i - 1]) + sizeof(HalfLinkArr) + sizeof(HalfLink) * self.links[i - 1].n) + * + */ + +# line 773 "core/core2.pyx" + } + + /* "core/core2.pyx":776 + * self.links[i] = ((self.links[i - 1]) + sizeof(HalfLinkArr) + sizeof(HalfLink) * self.links[i - 1].n) + * + * self.links[i].n = n # <<<<<<<<<<<<<< + * + * for j in range(n): + */ + +# line 776 "core/core2.pyx" + (__pyx_v_self->links[__pyx_v_i])->n = __pyx_v_n; + + /* "core/core2.pyx":778 + * self.links[i].n = n + * + * for j in range(n): # <<<<<<<<<<<<<< + * a = half_lst[j] + * self.links[i].half_links[j].a = a + */ + +# line 778 "core/core2.pyx" + __pyx_t_14 = __pyx_v_n; + +# line 778 "core/core2.pyx" + __pyx_t_15 = __pyx_t_14; + +# line 778 "core/core2.pyx" + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + +# line 778 "core/core2.pyx" + __pyx_v_j = __pyx_t_16; + + /* "core/core2.pyx":779 + * + * for j in range(n): + * a = half_lst[j] # <<<<<<<<<<<<<< + * self.links[i].half_links[j].a = a + * + */ + +# line 779 "core/core2.pyx" + if (unlikely(__pyx_v_half_lst == Py_None)) { + +# line 779 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 779 "core/core2.pyx" + __PYX_ERR(0, 779, __pyx_L1_error) + +# line 779 "core/core2.pyx" + } + +# line 779 "core/core2.pyx" + __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_half_lst, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __pyx_L1_error) + +# line 779 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 779 "core/core2.pyx" + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 779, __pyx_L1_error) + +# line 779 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 779 "core/core2.pyx" + __pyx_v_a = __pyx_t_17; + + /* "core/core2.pyx":780 + * for j in range(n): + * a = half_lst[j] + * self.links[i].half_links[j].a = a # <<<<<<<<<<<<<< + * + * self.lengths_update() + */ + +# line 780 "core/core2.pyx" + ((__pyx_v_self->links[__pyx_v_i])->half_links[__pyx_v_j]).a = __pyx_v_a; + +# line 780 "core/core2.pyx" + } + +# line 780 "core/core2.pyx" + } + + /* "core/core2.pyx":782 + * self.links[i].half_links[j].a = a + * + * self.lengths_update() # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + +# line 782 "core/core2.pyx" + ((struct __pyx_vtabstruct_14softwrap_core2_SpringLinks *)__pyx_v_self->__pyx_vtab)->lengths_update(__pyx_v_self, 0); + + /* "core/core2.pyx":754 + * + * @cython.boundscheck(True) + * def __cinit__(self, SpringEngine engine, list links): # <<<<<<<<<<<<<< + * self.engine = engine + * self.links = maelloc(sizeof(HalfLink**) * self.engine.n_verts, __LINE__) + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("softwrap_core2.SpringLinks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_arranged_links); + __Pyx_XDECREF(__pyx_v_half_lst); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":784 + * self.lengths_update() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.links[0]) + * fraeee(self.links) + */ + +/* Python wrapper */ +static void __pyx_pw_14softwrap_core2_11SpringLinks_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_14softwrap_core2_11SpringLinks_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_14softwrap_core2_11SpringLinks_2__dealloc__(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_14softwrap_core2_11SpringLinks_2__dealloc__(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "core/core2.pyx":785 + * + * def __dealloc__(self): + * fraeee(self.links[0]) # <<<<<<<<<<<<<< + * fraeee(self.links) + * + */ + +# line 785 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee((__pyx_v_self->links[0])); + + /* "core/core2.pyx":786 + * def __dealloc__(self): + * fraeee(self.links[0]) + * fraeee(self.links) # <<<<<<<<<<<<<< + * + * def __getitem__(self, int key): + */ + +# line 786 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->links); + + /* "core/core2.pyx":784 + * self.lengths_update() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.links[0]) + * fraeee(self.links) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "core/core2.pyx":788 + * fraeee(self.links) + * + * def __getitem__(self, int key): # <<<<<<<<<<<<<< + * if key < 0 or key >= self.engine.n_verts: + * raise IndexError + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_key); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_key) { + int __pyx_v_key; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + assert(__pyx_arg_key); { + __pyx_v_key = __Pyx_PyInt_As_int(__pyx_arg_key); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 788, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringLinks.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_11SpringLinks_4__getitem__(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self), ((int)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_4__getitem__(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, int __pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "core/core2.pyx":789 + * + * def __getitem__(self, int key): + * if key < 0 or key >= self.engine.n_verts: # <<<<<<<<<<<<<< + * raise IndexError + * + */ + +# line 789 "core/core2.pyx" + __pyx_t_2 = ((__pyx_v_key < 0) != 0); + +# line 789 "core/core2.pyx" + if (!__pyx_t_2) { + +# line 789 "core/core2.pyx" + } else { + +# line 789 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 789 "core/core2.pyx" + goto __pyx_L4_bool_binop_done; + +# line 789 "core/core2.pyx" + } + +# line 789 "core/core2.pyx" + __pyx_t_2 = ((__pyx_v_key >= __pyx_v_self->engine->n_verts) != 0); + +# line 789 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 789 "core/core2.pyx" + __pyx_L4_bool_binop_done:; + +# line 789 "core/core2.pyx" + if (unlikely(__pyx_t_1)) { + + /* "core/core2.pyx":790 + * def __getitem__(self, int key): + * if key < 0 or key >= self.engine.n_verts: + * raise IndexError # <<<<<<<<<<<<<< + * + * return LinkProbe(self, key) + */ + +# line 790 "core/core2.pyx" + __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); + +# line 790 "core/core2.pyx" + __PYX_ERR(0, 790, __pyx_L1_error) + + /* "core/core2.pyx":789 + * + * def __getitem__(self, int key): + * if key < 0 or key >= self.engine.n_verts: # <<<<<<<<<<<<<< + * raise IndexError + * + */ + +# line 789 "core/core2.pyx" + } + + /* "core/core2.pyx":792 + * raise IndexError + * + * return LinkProbe(self, key) # <<<<<<<<<<<<<< + * + * cpdef void lengths_update(self): + */ + +# line 792 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 792 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 792, __pyx_L1_error) + +# line 792 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 792 "core/core2.pyx" + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 792, __pyx_L1_error) + +# line 792 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 792 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + +# line 792 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + +# line 792 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self)); + +# line 792 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_3); + +# line 792 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + +# line 792 "core/core2.pyx" + __pyx_t_3 = 0; + +# line 792 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14softwrap_core2_LinkProbe), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 792, __pyx_L1_error) + +# line 792 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 792 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 792 "core/core2.pyx" + __pyx_r = __pyx_t_3; + +# line 792 "core/core2.pyx" + __pyx_t_3 = 0; + +# line 792 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":788 + * fraeee(self.links) + * + * def __getitem__(self, int key): # <<<<<<<<<<<<<< + * if key < 0 or key >= self.engine.n_verts: + * raise IndexError + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SpringLinks.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":794 + * return LinkProbe(self, key) + * + * cpdef void lengths_update(self): # <<<<<<<<<<<<<< + * cdef int i, j, a + * + */ + +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_7lengths_update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_14softwrap_core2_11SpringLinks_lengths_update(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_a; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lengths_update", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lengths_update); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_11SpringLinks_7lengths_update)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":797 + * cdef int i, j, a + * + * for i in range(self.engine.n_verts): # <<<<<<<<<<<<<< + * for j in range(self.links[i].n): + * a = self.links[i].half_links[j].a + */ + +# line 797 "core/core2.pyx" + __pyx_t_5 = __pyx_v_self->engine->n_verts; + +# line 797 "core/core2.pyx" + __pyx_t_6 = __pyx_t_5; + +# line 797 "core/core2.pyx" + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + +# line 797 "core/core2.pyx" + __pyx_v_i = __pyx_t_7; + + /* "core/core2.pyx":798 + * + * for i in range(self.engine.n_verts): + * for j in range(self.links[i].n): # <<<<<<<<<<<<<< + * a = self.links[i].half_links[j].a + * self.links[i].half_links[j].original_length = (self.engine.m.verts[i] - self.engine.m.verts[a]).len() + */ + +# line 798 "core/core2.pyx" + __pyx_t_8 = (__pyx_v_self->links[__pyx_v_i])->n; + +# line 798 "core/core2.pyx" + __pyx_t_9 = __pyx_t_8; + +# line 798 "core/core2.pyx" + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + +# line 798 "core/core2.pyx" + __pyx_v_j = __pyx_t_10; + + /* "core/core2.pyx":799 + * for i in range(self.engine.n_verts): + * for j in range(self.links[i].n): + * a = self.links[i].half_links[j].a # <<<<<<<<<<<<<< + * self.links[i].half_links[j].original_length = (self.engine.m.verts[i] - self.engine.m.verts[a]).len() + * self.links[i].half_links[j].scale = 1 + */ + +# line 799 "core/core2.pyx" + __pyx_t_11 = ((__pyx_v_self->links[__pyx_v_i])->half_links[__pyx_v_j]).a; + +# line 799 "core/core2.pyx" + __pyx_v_a = __pyx_t_11; + + /* "core/core2.pyx":800 + * for j in range(self.links[i].n): + * a = self.links[i].half_links[j].a + * self.links[i].half_links[j].original_length = (self.engine.m.verts[i] - self.engine.m.verts[a]).len() # <<<<<<<<<<<<<< + * self.links[i].half_links[j].scale = 1 + * + */ + +# line 800 "core/core2.pyx" + ((__pyx_v_self->links[__pyx_v_i])->half_links[__pyx_v_j]).original_length = ((__pyx_v_self->engine->m->verts[__pyx_v_i]) - (__pyx_v_self->engine->m->verts[__pyx_v_a])).len(); + + /* "core/core2.pyx":801 + * a = self.links[i].half_links[j].a + * self.links[i].half_links[j].original_length = (self.engine.m.verts[i] - self.engine.m.verts[a]).len() + * self.links[i].half_links[j].scale = 1 # <<<<<<<<<<<<<< + * + * cpdef void smooth(self, float factor): + */ + +# line 801 "core/core2.pyx" + ((__pyx_v_self->links[__pyx_v_i])->half_links[__pyx_v_j]).scale = 1.0; + +# line 801 "core/core2.pyx" + } + +# line 801 "core/core2.pyx" + } + + /* "core/core2.pyx":794 + * return LinkProbe(self, key) + * + * cpdef void lengths_update(self): # <<<<<<<<<<<<<< + * cdef int i, j, a + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("softwrap_core2.SpringLinks.lengths_update", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_7lengths_update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_7lengths_update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lengths_update (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_11SpringLinks_6lengths_update(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_6lengths_update(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lengths_update", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_11SpringLinks_lengths_update(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringLinks.lengths_update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":803 + * self.links[i].half_links[j].scale = 1 + * + * cpdef void smooth(self, float factor): # <<<<<<<<<<<<<< + * cdef int i, j, n + * cdef HalfLink* half_links + */ + +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_9smooth(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor); /*proto*/ +static void __pyx_f_14softwrap_core2_11SpringLinks_smooth(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_n; + struct HalfLink *__pyx_v_half_links; + vec3 __pyx_v_avg; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + struct HalfLink *__pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + vec3 *__pyx_t_14; + vec3 *__pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("smooth", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_smooth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_11SpringLinks_9smooth)) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_factor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":808 + * cdef vec3 avg + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * n = self.links[i].n + */ + +# line 808 "core/core2.pyx" + { + +# line 808 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 808 "core/core2.pyx" + PyThreadState *_save; + +# line 808 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 808 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 808 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":809 + * + * with nogil: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * n = self.links[i].n + * + */ + +# line 809 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->engine->n_verts; + +# line 809 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 809 "core/core2.pyx" + { + +# line 809 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 809 "core/core2.pyx" + #undef likely + +# line 809 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 809 "core/core2.pyx" + #endif + +# line 809 "core/core2.pyx" + __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; + +# line 809 "core/core2.pyx" + if (__pyx_t_8 > 0) + +# line 809 "core/core2.pyx" + { + +# line 809 "core/core2.pyx" + #ifdef _OPENMP + +# line 809 "core/core2.pyx" + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_avg) lastprivate(__pyx_v_half_links) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_n) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); + /* Initialize private variables to invalid values */ + __pyx_v_half_links = ((struct HalfLink *)1); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_n = ((int)0xbad0bad0); + + /* "core/core2.pyx":810 + * with nogil: + * for i in prange(self.engine.n_verts): + * n = self.links[i].n # <<<<<<<<<<<<<< + * + * half_links = self.links[i].half_links + */ + +# line 810 "core/core2.pyx" + __pyx_t_9 = (__pyx_v_self->links[__pyx_v_i])->n; + +# line 810 "core/core2.pyx" + __pyx_v_n = __pyx_t_9; + + /* "core/core2.pyx":812 + * n = self.links[i].n + * + * half_links = self.links[i].half_links # <<<<<<<<<<<<<< + * + * if n == 0: + */ + +# line 812 "core/core2.pyx" + __pyx_t_10 = (__pyx_v_self->links[__pyx_v_i])->half_links; + +# line 812 "core/core2.pyx" + __pyx_v_half_links = __pyx_t_10; + + /* "core/core2.pyx":814 + * half_links = self.links[i].half_links + * + * if n == 0: # <<<<<<<<<<<<<< + * avg = self.engine.m.verts[i] + * continue + */ + +# line 814 "core/core2.pyx" + __pyx_t_11 = ((__pyx_v_n == 0) != 0); + +# line 814 "core/core2.pyx" + if (__pyx_t_11) { + + /* "core/core2.pyx":815 + * + * if n == 0: + * avg = self.engine.m.verts[i] # <<<<<<<<<<<<<< + * continue + * + */ + +# line 815 "core/core2.pyx" + __pyx_v_avg = (__pyx_v_self->engine->m->verts[__pyx_v_i]); + + /* "core/core2.pyx":816 + * if n == 0: + * avg = self.engine.m.verts[i] + * continue # <<<<<<<<<<<<<< + * + * avg = vec3(0) + */ + +# line 816 "core/core2.pyx" + goto __pyx_L6_continue; + + /* "core/core2.pyx":814 + * half_links = self.links[i].half_links + * + * if n == 0: # <<<<<<<<<<<<<< + * avg = self.engine.m.verts[i] + * continue + */ + +# line 814 "core/core2.pyx" + } + + /* "core/core2.pyx":818 + * continue + * + * avg = vec3(0) # <<<<<<<<<<<<<< + * + * for j in range(n): + */ + +# line 818 "core/core2.pyx" + __pyx_v_avg = vec3(0.0); + + /* "core/core2.pyx":820 + * avg = vec3(0) + * + * for j in range(n): # <<<<<<<<<<<<<< + * avg = avg + self.engine.m.verts[half_links[j].a] + * + */ + +# line 820 "core/core2.pyx" + __pyx_t_9 = __pyx_v_n; + +# line 820 "core/core2.pyx" + __pyx_t_12 = __pyx_t_9; + +# line 820 "core/core2.pyx" + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + +# line 820 "core/core2.pyx" + __pyx_v_j = __pyx_t_13; + + /* "core/core2.pyx":821 + * + * for j in range(n): + * avg = avg + self.engine.m.verts[half_links[j].a] # <<<<<<<<<<<<<< + * + * avg = avg * 1.0 / n + */ + +# line 821 "core/core2.pyx" + __pyx_v_avg = (__pyx_v_avg + (__pyx_v_self->engine->m->verts[(__pyx_v_half_links[__pyx_v_j]).a])); + +# line 821 "core/core2.pyx" + } + + /* "core/core2.pyx":823 + * avg = avg + self.engine.m.verts[half_links[j].a] + * + * avg = avg * 1.0 / n # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts[i] = self.engine.m.verts[i].lerp(avg, factor) + */ + +# line 823 "core/core2.pyx" + __pyx_v_avg = ((__pyx_v_avg * ((float)1.0)) / __pyx_v_n); + + /* "core/core2.pyx":825 + * avg = avg * 1.0 / n + * + * self.engine.tmp_verts[i] = self.engine.m.verts[i].lerp(avg, factor) # <<<<<<<<<<<<<< + * + * self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts + */ + +# line 825 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) = (__pyx_v_self->engine->m->verts[__pyx_v_i]).lerp(__pyx_v_avg, __pyx_v_factor); + +# line 825 "core/core2.pyx" + goto __pyx_L14; + +# line 825 "core/core2.pyx" + __pyx_L6_continue:; + +# line 825 "core/core2.pyx" + goto __pyx_L14; + +# line 825 "core/core2.pyx" + __pyx_L14:; + +# line 825 "core/core2.pyx" + } + +# line 825 "core/core2.pyx" + } + +# line 825 "core/core2.pyx" + } + +# line 825 "core/core2.pyx" + } + +# line 825 "core/core2.pyx" + } + +# line 825 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 825 "core/core2.pyx" + #undef likely + +# line 825 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 825 "core/core2.pyx" + #endif + +# line 825 "core/core2.pyx" + } + + /* "core/core2.pyx":808 + * cdef vec3 avg + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * n = self.links[i].n + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "core/core2.pyx":827 + * self.engine.tmp_verts[i] = self.engine.m.verts[i].lerp(avg, factor) + * + * self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts # <<<<<<<<<<<<<< + * + * + */ + +# line 827 "core/core2.pyx" + __pyx_t_14 = __pyx_v_self->engine->tmp_verts; + +# line 827 "core/core2.pyx" + __pyx_t_15 = __pyx_v_self->engine->m->verts; + +# line 827 "core/core2.pyx" + __pyx_v_self->engine->m->verts = __pyx_t_14; + +# line 827 "core/core2.pyx" + __pyx_v_self->engine->tmp_verts = __pyx_t_15; + + /* "core/core2.pyx":803 + * self.links[i].half_links[j].scale = 1 + * + * cpdef void smooth(self, float factor): # <<<<<<<<<<<<<< + * cdef int i, j, n + * cdef HalfLink* half_links + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("softwrap_core2.SpringLinks.smooth", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_9smooth(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_9smooth(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor) { + float __pyx_v_factor; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("smooth (wrapper)", 0); + assert(__pyx_arg_factor); { + __pyx_v_factor = __pyx_PyFloat_AsFloat(__pyx_arg_factor); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 803, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringLinks.smooth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_11SpringLinks_8smooth(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self), ((float)__pyx_v_factor)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_8smooth(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("smooth", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_11SpringLinks_smooth(__pyx_v_self, __pyx_v_factor, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringLinks.smooth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":830 + * + * + * cpdef void soft_spring_force(self, float factor, float deform_update=0.3, float deform_restore=0.03, float min_deform=0.3, float max_deform=3.0): # <<<<<<<<<<<<<< + * cdef int i, j, n, a + * cdef HalfLink* half_links + */ + +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_11soft_spring_force(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_14softwrap_core2_11SpringLinks_soft_spring_force(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_11SpringLinks_soft_spring_force *__pyx_optional_args) { + float __pyx_v_deform_update = ((float)0.3); + float __pyx_v_deform_restore = ((float)0.03); + float __pyx_v_min_deform = ((float)0.3); + float __pyx_v_max_deform = ((float)3.0); + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_n; + int __pyx_v_a; + struct HalfLink *__pyx_v_half_links; + vec3 __pyx_v_delta; + float __pyx_v_curr_length; + float __pyx_v_diff; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + struct HalfLink *__pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + vec3 *__pyx_t_19; + vec3 *__pyx_t_20; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("soft_spring_force", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_deform_update = __pyx_optional_args->deform_update; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_deform_restore = __pyx_optional_args->deform_restore; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_min_deform = __pyx_optional_args->min_deform; + if (__pyx_optional_args->__pyx_n > 3) { + __pyx_v_max_deform = __pyx_optional_args->max_deform; + } + } + } + } + } + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_soft_spring_force); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_11SpringLinks_11soft_spring_force)) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_factor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_deform_update); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_deform_restore); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyFloat_FromDouble(__pyx_v_min_deform); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_max_deform); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_8 = __pyx_t_1; __pyx_t_9 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_8)) { + PyObject *__pyx_temp[6] = {__pyx_t_9, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { + PyObject *__pyx_temp[6] = {__pyx_t_9, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + { + __pyx_t_11 = PyTuple_New(5+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__pyx_t_9) { + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_t_7); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":836 + * cdef float curr_length, diff + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * n = self.links[i].n + */ + +# line 836 "core/core2.pyx" + { + +# line 836 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 836 "core/core2.pyx" + PyThreadState *_save; + +# line 836 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 836 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 836 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":837 + * + * with nogil: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * n = self.links[i].n + * + */ + +# line 837 "core/core2.pyx" + __pyx_t_10 = __pyx_v_self->engine->n_verts; + +# line 837 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 837 "core/core2.pyx" + { + +# line 837 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 837 "core/core2.pyx" + #undef likely + +# line 837 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 837 "core/core2.pyx" + #endif + +# line 837 "core/core2.pyx" + __pyx_t_13 = (__pyx_t_10 - 0 + 1 - 1/abs(1)) / 1; + +# line 837 "core/core2.pyx" + if (__pyx_t_13 > 0) + +# line 837 "core/core2.pyx" + { + +# line 837 "core/core2.pyx" + #ifdef _OPENMP + +# line 837 "core/core2.pyx" + #pragma omp parallel private(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_a) lastprivate(__pyx_v_curr_length) lastprivate(__pyx_v_delta) lastprivate(__pyx_v_diff) lastprivate(__pyx_v_half_links) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_n) + #endif /* _OPENMP */ + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_12); + /* Initialize private variables to invalid values */ + __pyx_v_a = ((int)0xbad0bad0); + __pyx_v_curr_length = ((float)__PYX_NAN()); + __pyx_v_diff = ((float)__PYX_NAN()); + __pyx_v_half_links = ((struct HalfLink *)1); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_n = ((int)0xbad0bad0); + + /* "core/core2.pyx":838 + * with nogil: + * for i in prange(self.engine.n_verts): + * n = self.links[i].n # <<<<<<<<<<<<<< + * + * half_links = self.links[i].half_links + */ + +# line 838 "core/core2.pyx" + __pyx_t_14 = (__pyx_v_self->links[__pyx_v_i])->n; + +# line 838 "core/core2.pyx" + __pyx_v_n = __pyx_t_14; + + /* "core/core2.pyx":840 + * n = self.links[i].n + * + * half_links = self.links[i].half_links # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts[i] = vec3(0) + */ + +# line 840 "core/core2.pyx" + __pyx_t_15 = (__pyx_v_self->links[__pyx_v_i])->half_links; + +# line 840 "core/core2.pyx" + __pyx_v_half_links = __pyx_t_15; + + /* "core/core2.pyx":842 + * half_links = self.links[i].half_links + * + * self.engine.tmp_verts[i] = vec3(0) # <<<<<<<<<<<<<< + * + * for j in range(n): + */ + +# line 842 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) = vec3(0.0); + + /* "core/core2.pyx":844 + * self.engine.tmp_verts[i] = vec3(0) + * + * for j in range(n): # <<<<<<<<<<<<<< + * a = half_links[j].a + * + */ + +# line 844 "core/core2.pyx" + __pyx_t_14 = __pyx_v_n; + +# line 844 "core/core2.pyx" + __pyx_t_16 = __pyx_t_14; + +# line 844 "core/core2.pyx" + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + +# line 844 "core/core2.pyx" + __pyx_v_j = __pyx_t_17; + + /* "core/core2.pyx":845 + * + * for j in range(n): + * a = half_links[j].a # <<<<<<<<<<<<<< + * + * delta = self.engine.m.verts[i] - self.engine.m.verts[a] + */ + +# line 845 "core/core2.pyx" + __pyx_t_18 = (__pyx_v_half_links[__pyx_v_j]).a; + +# line 845 "core/core2.pyx" + __pyx_v_a = __pyx_t_18; + + /* "core/core2.pyx":847 + * a = half_links[j].a + * + * delta = self.engine.m.verts[i] - self.engine.m.verts[a] # <<<<<<<<<<<<<< + * curr_length = nmax(delta.len(), EPS) + * diff = ((half_links[j].original_length * half_links[j].scale - curr_length) / curr_length) + */ + +# line 847 "core/core2.pyx" + __pyx_v_delta = ((__pyx_v_self->engine->m->verts[__pyx_v_i]) - (__pyx_v_self->engine->m->verts[__pyx_v_a])); + + /* "core/core2.pyx":848 + * + * delta = self.engine.m.verts[i] - self.engine.m.verts[a] + * curr_length = nmax(delta.len(), EPS) # <<<<<<<<<<<<<< + * diff = ((half_links[j].original_length * half_links[j].scale - curr_length) / curr_length) + * self.engine.tmp_verts[i] += delta * diff + */ + +# line 848 "core/core2.pyx" + __pyx_v_curr_length = nmax(__pyx_v_delta.len(), EPS); + + /* "core/core2.pyx":849 + * delta = self.engine.m.verts[i] - self.engine.m.verts[a] + * curr_length = nmax(delta.len(), EPS) + * diff = ((half_links[j].original_length * half_links[j].scale - curr_length) / curr_length) # <<<<<<<<<<<<<< + * self.engine.tmp_verts[i] += delta * diff + * half_links[j].scale = nlerp(half_links[j].scale, nclamp(curr_length / half_links[j].original_length, min_deform, max_deform), deform_update) + */ + +# line 849 "core/core2.pyx" + __pyx_v_diff = ((((__pyx_v_half_links[__pyx_v_j]).original_length * (__pyx_v_half_links[__pyx_v_j]).scale) - __pyx_v_curr_length) / __pyx_v_curr_length); + + /* "core/core2.pyx":850 + * curr_length = nmax(delta.len(), EPS) + * diff = ((half_links[j].original_length * half_links[j].scale - curr_length) / curr_length) + * self.engine.tmp_verts[i] += delta * diff # <<<<<<<<<<<<<< + * half_links[j].scale = nlerp(half_links[j].scale, nclamp(curr_length / half_links[j].original_length, min_deform, max_deform), deform_update) + * half_links[j].scale = nlerp(half_links[j].scale, 1, deform_restore) + */ + +# line 850 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) += (__pyx_v_delta * __pyx_v_diff); + + /* "core/core2.pyx":851 + * diff = ((half_links[j].original_length * half_links[j].scale - curr_length) / curr_length) + * self.engine.tmp_verts[i] += delta * diff + * half_links[j].scale = nlerp(half_links[j].scale, nclamp(curr_length / half_links[j].original_length, min_deform, max_deform), deform_update) # <<<<<<<<<<<<<< + * half_links[j].scale = nlerp(half_links[j].scale, 1, deform_restore) + * + */ + +# line 851 "core/core2.pyx" + (__pyx_v_half_links[__pyx_v_j]).scale = nlerp((__pyx_v_half_links[__pyx_v_j]).scale, nclamp((__pyx_v_curr_length / (__pyx_v_half_links[__pyx_v_j]).original_length), __pyx_v_min_deform, __pyx_v_max_deform), __pyx_v_deform_update); + + /* "core/core2.pyx":852 + * self.engine.tmp_verts[i] += delta * diff + * half_links[j].scale = nlerp(half_links[j].scale, nclamp(curr_length / half_links[j].original_length, min_deform, max_deform), deform_update) + * half_links[j].scale = nlerp(half_links[j].scale, 1, deform_restore) # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts[i] *= 1.0 / (n + EPS) * factor + */ + +# line 852 "core/core2.pyx" + (__pyx_v_half_links[__pyx_v_j]).scale = nlerp((__pyx_v_half_links[__pyx_v_j]).scale, 1, __pyx_v_deform_restore); + +# line 852 "core/core2.pyx" + } + + /* "core/core2.pyx":854 + * half_links[j].scale = nlerp(half_links[j].scale, 1, deform_restore) + * + * self.engine.tmp_verts[i] *= 1.0 / (n + EPS) * factor # <<<<<<<<<<<<<< + * self.engine.tmp_verts[i] += self.engine.m.verts[i] + * + */ + +# line 854 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) *= ((((float)1.0) / (__pyx_v_n + EPS)) * __pyx_v_factor); + + /* "core/core2.pyx":855 + * + * self.engine.tmp_verts[i] *= 1.0 / (n + EPS) * factor + * self.engine.tmp_verts[i] += self.engine.m.verts[i] # <<<<<<<<<<<<<< + * + * self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts + */ + +# line 855 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) += (__pyx_v_self->engine->m->verts[__pyx_v_i]); + +# line 855 "core/core2.pyx" + } + +# line 855 "core/core2.pyx" + } + +# line 855 "core/core2.pyx" + } + +# line 855 "core/core2.pyx" + } + +# line 855 "core/core2.pyx" + } + +# line 855 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 855 "core/core2.pyx" + #undef likely + +# line 855 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 855 "core/core2.pyx" + #endif + +# line 855 "core/core2.pyx" + } + + /* "core/core2.pyx":836 + * cdef float curr_length, diff + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * n = self.links[i].n + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "core/core2.pyx":857 + * self.engine.tmp_verts[i] += self.engine.m.verts[i] + * + * self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts # <<<<<<<<<<<<<< + * + * cpdef void stiff_spring_force(self, float factor): + */ + +# line 857 "core/core2.pyx" + __pyx_t_19 = __pyx_v_self->engine->tmp_verts; + +# line 857 "core/core2.pyx" + __pyx_t_20 = __pyx_v_self->engine->m->verts; + +# line 857 "core/core2.pyx" + __pyx_v_self->engine->m->verts = __pyx_t_19; + +# line 857 "core/core2.pyx" + __pyx_v_self->engine->tmp_verts = __pyx_t_20; + + /* "core/core2.pyx":830 + * + * + * cpdef void soft_spring_force(self, float factor, float deform_update=0.3, float deform_restore=0.03, float min_deform=0.3, float max_deform=3.0): # <<<<<<<<<<<<<< + * cdef int i, j, n, a + * cdef HalfLink* half_links + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_WriteUnraisable("softwrap_core2.SpringLinks.soft_spring_force", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_11soft_spring_force(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_11soft_spring_force(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_factor; + float __pyx_v_deform_update; + float __pyx_v_deform_restore; + float __pyx_v_min_deform; + float __pyx_v_max_deform; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("soft_spring_force (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_factor,&__pyx_n_s_deform_update,&__pyx_n_s_deform_restore,&__pyx_n_s_min_deform,&__pyx_n_s_max_deform,0}; + PyObject* values[5] = {0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_deform_update); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_deform_restore); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_deform); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_deform); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "soft_spring_force") < 0)) __PYX_ERR(0, 830, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_factor = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 830, __pyx_L3_error) + if (values[1]) { + __pyx_v_deform_update = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_deform_update == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 830, __pyx_L3_error) + } else { + __pyx_v_deform_update = ((float)0.3); + } + if (values[2]) { + __pyx_v_deform_restore = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_deform_restore == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 830, __pyx_L3_error) + } else { + __pyx_v_deform_restore = ((float)0.03); + } + if (values[3]) { + __pyx_v_min_deform = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_min_deform == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 830, __pyx_L3_error) + } else { + __pyx_v_min_deform = ((float)0.3); + } + if (values[4]) { + __pyx_v_max_deform = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_max_deform == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 830, __pyx_L3_error) + } else { + __pyx_v_max_deform = ((float)3.0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("soft_spring_force", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 830, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringLinks.soft_spring_force", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_11SpringLinks_10soft_spring_force(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self), __pyx_v_factor, __pyx_v_deform_update, __pyx_v_deform_restore, __pyx_v_min_deform, __pyx_v_max_deform); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_10soft_spring_force(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor, float __pyx_v_deform_update, float __pyx_v_deform_restore, float __pyx_v_min_deform, float __pyx_v_max_deform) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_14softwrap_core2_11SpringLinks_soft_spring_force __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("soft_spring_force", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1.__pyx_n = 4; + __pyx_t_1.deform_update = __pyx_v_deform_update; + __pyx_t_1.deform_restore = __pyx_v_deform_restore; + __pyx_t_1.min_deform = __pyx_v_min_deform; + __pyx_t_1.max_deform = __pyx_v_max_deform; + __pyx_vtabptr_14softwrap_core2_SpringLinks->soft_spring_force(__pyx_v_self, __pyx_v_factor, 1, &__pyx_t_1); + __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("softwrap_core2.SpringLinks.soft_spring_force", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":859 + * self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts + * + * cpdef void stiff_spring_force(self, float factor): # <<<<<<<<<<<<<< + * cdef int i, j, n, a + * cdef HalfLink* half_links + */ + +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_13stiff_spring_force(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor); /*proto*/ +static void __pyx_f_14softwrap_core2_11SpringLinks_stiff_spring_force(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_n; + int __pyx_v_a; + struct HalfLink *__pyx_v_half_links; + vec3 __pyx_v_delta; + float __pyx_v_curr_length; + float __pyx_v_diff; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + struct HalfLink *__pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + vec3 *__pyx_t_14; + vec3 *__pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stiff_spring_force", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stiff_spring_force); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_11SpringLinks_13stiff_spring_force)) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_factor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":864 + * cdef vec3 delta + * cdef float curr_length, diff + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * n = self.links[i].n + */ + +# line 864 "core/core2.pyx" + { + +# line 864 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 864 "core/core2.pyx" + PyThreadState *_save; + +# line 864 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 864 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 864 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":865 + * cdef float curr_length, diff + * with nogil: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * n = self.links[i].n + * + */ + +# line 865 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->engine->n_verts; + +# line 865 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 865 "core/core2.pyx" + { + +# line 865 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 865 "core/core2.pyx" + #undef likely + +# line 865 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 865 "core/core2.pyx" + #endif + +# line 865 "core/core2.pyx" + __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; + +# line 865 "core/core2.pyx" + if (__pyx_t_8 > 0) + +# line 865 "core/core2.pyx" + { + +# line 865 "core/core2.pyx" + #ifdef _OPENMP + +# line 865 "core/core2.pyx" + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_a) lastprivate(__pyx_v_curr_length) lastprivate(__pyx_v_delta) lastprivate(__pyx_v_diff) lastprivate(__pyx_v_half_links) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_n) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); + /* Initialize private variables to invalid values */ + __pyx_v_a = ((int)0xbad0bad0); + __pyx_v_curr_length = ((float)__PYX_NAN()); + __pyx_v_diff = ((float)__PYX_NAN()); + __pyx_v_half_links = ((struct HalfLink *)1); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_n = ((int)0xbad0bad0); + + /* "core/core2.pyx":866 + * with nogil: + * for i in prange(self.engine.n_verts): + * n = self.links[i].n # <<<<<<<<<<<<<< + * + * half_links = self.links[i].half_links + */ + +# line 866 "core/core2.pyx" + __pyx_t_9 = (__pyx_v_self->links[__pyx_v_i])->n; + +# line 866 "core/core2.pyx" + __pyx_v_n = __pyx_t_9; + + /* "core/core2.pyx":868 + * n = self.links[i].n + * + * half_links = self.links[i].half_links # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts[i] = vec3(0) + */ + +# line 868 "core/core2.pyx" + __pyx_t_10 = (__pyx_v_self->links[__pyx_v_i])->half_links; + +# line 868 "core/core2.pyx" + __pyx_v_half_links = __pyx_t_10; + + /* "core/core2.pyx":870 + * half_links = self.links[i].half_links + * + * self.engine.tmp_verts[i] = vec3(0) # <<<<<<<<<<<<<< + * + * for j in range(n): + */ + +# line 870 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) = vec3(0.0); + + /* "core/core2.pyx":872 + * self.engine.tmp_verts[i] = vec3(0) + * + * for j in range(n): # <<<<<<<<<<<<<< + * a = half_links[j].a + * + */ + +# line 872 "core/core2.pyx" + __pyx_t_9 = __pyx_v_n; + +# line 872 "core/core2.pyx" + __pyx_t_11 = __pyx_t_9; + +# line 872 "core/core2.pyx" + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + +# line 872 "core/core2.pyx" + __pyx_v_j = __pyx_t_12; + + /* "core/core2.pyx":873 + * + * for j in range(n): + * a = half_links[j].a # <<<<<<<<<<<<<< + * + * delta = self.engine.m.verts[i] - self.engine.m.verts[a] + */ + +# line 873 "core/core2.pyx" + __pyx_t_13 = (__pyx_v_half_links[__pyx_v_j]).a; + +# line 873 "core/core2.pyx" + __pyx_v_a = __pyx_t_13; + + /* "core/core2.pyx":875 + * a = half_links[j].a + * + * delta = self.engine.m.verts[i] - self.engine.m.verts[a] # <<<<<<<<<<<<<< + * curr_length = delta.len() + * + */ + +# line 875 "core/core2.pyx" + __pyx_v_delta = ((__pyx_v_self->engine->m->verts[__pyx_v_i]) - (__pyx_v_self->engine->m->verts[__pyx_v_a])); + + /* "core/core2.pyx":876 + * + * delta = self.engine.m.verts[i] - self.engine.m.verts[a] + * curr_length = delta.len() # <<<<<<<<<<<<<< + * + * diff = (half_links[j].original_length * half_links[j].scale) / curr_length + */ + +# line 876 "core/core2.pyx" + __pyx_v_curr_length = __pyx_v_delta.len(); + + /* "core/core2.pyx":878 + * curr_length = delta.len() + * + * diff = (half_links[j].original_length * half_links[j].scale) / curr_length # <<<<<<<<<<<<<< + * + * diff = nlerp(1.0, diff, factor) + */ + +# line 878 "core/core2.pyx" + __pyx_v_diff = (((__pyx_v_half_links[__pyx_v_j]).original_length * (__pyx_v_half_links[__pyx_v_j]).scale) / __pyx_v_curr_length); + + /* "core/core2.pyx":880 + * diff = (half_links[j].original_length * half_links[j].scale) / curr_length + * + * diff = nlerp(1.0, diff, factor) # <<<<<<<<<<<<<< + * + * delta = delta * diff + */ + +# line 880 "core/core2.pyx" + __pyx_v_diff = nlerp(((float)1.0), __pyx_v_diff, __pyx_v_factor); + + /* "core/core2.pyx":882 + * diff = nlerp(1.0, diff, factor) + * + * delta = delta * diff # <<<<<<<<<<<<<< + * self.engine.tmp_verts[i] += delta + self.engine.m.verts[a] + * + */ + +# line 882 "core/core2.pyx" + __pyx_v_delta = (__pyx_v_delta * __pyx_v_diff); + + /* "core/core2.pyx":883 + * + * delta = delta * diff + * self.engine.tmp_verts[i] += delta + self.engine.m.verts[a] # <<<<<<<<<<<<<< + * + * + */ + +# line 883 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) += (__pyx_v_delta + (__pyx_v_self->engine->m->verts[__pyx_v_a])); + +# line 883 "core/core2.pyx" + } + + /* "core/core2.pyx":886 + * + * + * self.engine.tmp_verts[i] *= 1.0 / nmax(n, 1) # <<<<<<<<<<<<<< + * + * self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts + */ + +# line 886 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) *= (((float)1.0) / ((float)nmax(__pyx_v_n, 1))); + +# line 886 "core/core2.pyx" + } + +# line 886 "core/core2.pyx" + } + +# line 886 "core/core2.pyx" + } + +# line 886 "core/core2.pyx" + } + +# line 886 "core/core2.pyx" + } + +# line 886 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 886 "core/core2.pyx" + #undef likely + +# line 886 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 886 "core/core2.pyx" + #endif + +# line 886 "core/core2.pyx" + } + + /* "core/core2.pyx":864 + * cdef vec3 delta + * cdef float curr_length, diff + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * n = self.links[i].n + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "core/core2.pyx":888 + * self.engine.tmp_verts[i] *= 1.0 / nmax(n, 1) + * + * self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts # <<<<<<<<<<<<<< + * + * + */ + +# line 888 "core/core2.pyx" + __pyx_t_14 = __pyx_v_self->engine->tmp_verts; + +# line 888 "core/core2.pyx" + __pyx_t_15 = __pyx_v_self->engine->m->verts; + +# line 888 "core/core2.pyx" + __pyx_v_self->engine->m->verts = __pyx_t_14; + +# line 888 "core/core2.pyx" + __pyx_v_self->engine->tmp_verts = __pyx_t_15; + + /* "core/core2.pyx":859 + * self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts + * + * cpdef void stiff_spring_force(self, float factor): # <<<<<<<<<<<<<< + * cdef int i, j, n, a + * cdef HalfLink* half_links + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("softwrap_core2.SpringLinks.stiff_spring_force", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_13stiff_spring_force(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_13stiff_spring_force(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor) { + float __pyx_v_factor; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stiff_spring_force (wrapper)", 0); + assert(__pyx_arg_factor); { + __pyx_v_factor = __pyx_PyFloat_AsFloat(__pyx_arg_factor); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringLinks.stiff_spring_force", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_11SpringLinks_12stiff_spring_force(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self), ((float)__pyx_v_factor)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_12stiff_spring_force(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, float __pyx_v_factor) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stiff_spring_force", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_11SpringLinks_stiff_spring_force(__pyx_v_self, __pyx_v_factor, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringLinks.stiff_spring_force", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":749 + * cdef class SpringLinks: + * + * cdef readonly SpringEngine engine # <<<<<<<<<<<<<< + * cdef int max_links + * cdef HalfLinkArr** links + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_6engine_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_6engine_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_11SpringLinks_6engine___get__(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_6engine___get__(struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->engine)); + __pyx_r = ((PyObject *)__pyx_v_self->engine); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_11SpringLinks_14__reduce_cython__(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringLinks.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SpringLinks_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_11SpringLinks_16__setstate_cython__(((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SpringLinks_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringLinks.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":920 + * + * @cython.boundscheck(True) + * def __cinit__(self, SpringEngine engine, list links): # <<<<<<<<<<<<<< + * self.engine = engine + * + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_21TernarySmoothingLinks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_21TernarySmoothingLinks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine = 0; + PyObject *__pyx_v_links = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_engine,&__pyx_n_s_links,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_engine)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_links)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 920, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 920, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)values[0]); + __pyx_v_links = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 920, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.TernarySmoothingLinks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_engine), __pyx_ptype_14softwrap_core2_SpringEngine, 1, "engine", 0))) __PYX_ERR(0, 920, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_links), (&PyList_Type), 1, "links", 1))) __PYX_ERR(0, 920, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_21TernarySmoothingLinks___cinit__(((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)__pyx_v_self), __pyx_v_engine, __pyx_v_links); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_21TernarySmoothingLinks___cinit__(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine, PyObject *__pyx_v_links) { + PyObject *__pyx_v_arranged_links = 0; + int __pyx_v_c; + int __pyx_v_a; + int __pyx_v_b; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_n; + PyObject *__pyx_v_links_lst = 0; + CYTHON_UNUSED int __pyx_8genexpr1__pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + void *__pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *(*__pyx_t_12)(PyObject *); + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "core/core2.pyx":921 + * @cython.boundscheck(True) + * def __cinit__(self, SpringEngine engine, list links): + * self.engine = engine # <<<<<<<<<<<<<< + * + * self.links = maelloc(sizeof(TernaryLinkArr**) * engine.n_verts, __LINE__) + */ + +# line 921 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_engine)); + +# line 921 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_engine)); + +# line 921 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->engine); + +# line 921 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->engine)); + +# line 921 "core/core2.pyx" + __pyx_v_self->engine = __pyx_v_engine; + + /* "core/core2.pyx":923 + * self.engine = engine + * + * self.links = maelloc(sizeof(TernaryLinkArr**) * engine.n_verts, __LINE__) # <<<<<<<<<<<<<< + * self.links[0] = maelloc(sizeof(TernaryLinkArr) * engine.n_verts + sizeof(TernaryLink) * len(links), __LINE__) + * + */ + +# line 923 "core/core2.pyx" + __pyx_t_1 = __pyx_f_14softwrap_core2_maelloc(((sizeof(struct TernaryLinkArr **)) * __pyx_v_engine->n_verts), __LINE__); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(0, 923, __pyx_L1_error) + +# line 923 "core/core2.pyx" + __pyx_v_self->links = ((struct TernaryLinkArr **)__pyx_t_1); + + /* "core/core2.pyx":924 + * + * self.links = maelloc(sizeof(TernaryLinkArr**) * engine.n_verts, __LINE__) + * self.links[0] = maelloc(sizeof(TernaryLinkArr) * engine.n_verts + sizeof(TernaryLink) * len(links), __LINE__) # <<<<<<<<<<<<<< + * + * cdef list arranged_links = [[] for i in range(engine.n_verts)] + */ + +# line 924 "core/core2.pyx" + if (unlikely(__pyx_v_links == Py_None)) { + +# line 924 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 924 "core/core2.pyx" + __PYX_ERR(0, 924, __pyx_L1_error) + +# line 924 "core/core2.pyx" + } + +# line 924 "core/core2.pyx" + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_links); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 924, __pyx_L1_error) + +# line 924 "core/core2.pyx" + __pyx_t_1 = __pyx_f_14softwrap_core2_maelloc((((sizeof(struct TernaryLinkArr)) * __pyx_v_engine->n_verts) + ((sizeof(struct TernaryLink)) * __pyx_t_2)), __LINE__); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(0, 924, __pyx_L1_error) + +# line 924 "core/core2.pyx" + (__pyx_v_self->links[0]) = ((struct TernaryLinkArr *)__pyx_t_1); + + /* "core/core2.pyx":926 + * self.links[0] = maelloc(sizeof(TernaryLinkArr) * engine.n_verts + sizeof(TernaryLink) * len(links), __LINE__) + * + * cdef list arranged_links = [[] for i in range(engine.n_verts)] # <<<<<<<<<<<<<< + * + * cdef int c, a, b, i, j, n + */ + { /* enter inner scope */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_v_engine->n_verts; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_8genexpr1__pyx_v_i = __pyx_t_6; + __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 926, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 926, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + } /* exit inner scope */ + __pyx_v_arranged_links = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "core/core2.pyx":930 + * cdef int c, a, b, i, j, n + * + * for c, a, b in links: # <<<<<<<<<<<<<< + * arranged_links[c].append((a, b)) + * + */ + +# line 930 "core/core2.pyx" + if (unlikely(__pyx_v_links == Py_None)) { + +# line 930 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + +# line 930 "core/core2.pyx" + __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + } + +# line 930 "core/core2.pyx" + __pyx_t_3 = __pyx_v_links; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0; + +# line 930 "core/core2.pyx" + for (;;) { + +# line 930 "core/core2.pyx" + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; + +# line 930 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 930 "core/core2.pyx" + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + #else + +# line 930 "core/core2.pyx" + __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 930 "core/core2.pyx" + #endif + +# line 930 "core/core2.pyx" + if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { + +# line 930 "core/core2.pyx" + PyObject* sequence = __pyx_t_7; + +# line 930 "core/core2.pyx" + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + +# line 930 "core/core2.pyx" + if (unlikely(size != 3)) { + +# line 930 "core/core2.pyx" + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + +# line 930 "core/core2.pyx" + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + +# line 930 "core/core2.pyx" + __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + } + +# line 930 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 930 "core/core2.pyx" + if (likely(PyTuple_CheckExact(sequence))) { + +# line 930 "core/core2.pyx" + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + +# line 930 "core/core2.pyx" + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); + +# line 930 "core/core2.pyx" + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); + +# line 930 "core/core2.pyx" + } else { + +# line 930 "core/core2.pyx" + __pyx_t_8 = PyList_GET_ITEM(sequence, 0); + +# line 930 "core/core2.pyx" + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); + +# line 930 "core/core2.pyx" + __pyx_t_10 = PyList_GET_ITEM(sequence, 2); + +# line 930 "core/core2.pyx" + } + +# line 930 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_8); + +# line 930 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_9); + +# line 930 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_10); + +# line 930 "core/core2.pyx" + #else + +# line 930 "core/core2.pyx" + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 930 "core/core2.pyx" + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 930 "core/core2.pyx" + __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_10); + +# line 930 "core/core2.pyx" + #endif + +# line 930 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 930 "core/core2.pyx" + } else { + +# line 930 "core/core2.pyx" + Py_ssize_t index = -1; + +# line 930 "core/core2.pyx" + __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_11); + +# line 930 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 930 "core/core2.pyx" + __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; + +# line 930 "core/core2.pyx" + index = 0; __pyx_t_8 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed; + +# line 930 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 930 "core/core2.pyx" + index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed; + +# line 930 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 930 "core/core2.pyx" + index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L7_unpacking_failed; + +# line 930 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_10); + +# line 930 "core/core2.pyx" + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __pyx_t_12 = NULL; + +# line 930 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + +# line 930 "core/core2.pyx" + goto __pyx_L8_unpacking_done; + +# line 930 "core/core2.pyx" + __pyx_L7_unpacking_failed:; + +# line 930 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + +# line 930 "core/core2.pyx" + __pyx_t_12 = NULL; + +# line 930 "core/core2.pyx" + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + +# line 930 "core/core2.pyx" + __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __pyx_L8_unpacking_done:; + +# line 930 "core/core2.pyx" + } + +# line 930 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + +# line 930 "core/core2.pyx" + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + +# line 930 "core/core2.pyx" + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L1_error) + +# line 930 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + +# line 930 "core/core2.pyx" + __pyx_v_c = __pyx_t_4; + +# line 930 "core/core2.pyx" + __pyx_v_a = __pyx_t_5; + +# line 930 "core/core2.pyx" + __pyx_v_b = __pyx_t_6; + + /* "core/core2.pyx":931 + * + * for c, a, b in links: + * arranged_links[c].append((a, b)) # <<<<<<<<<<<<<< + * + * cdef list links_lst + */ + +# line 931 "core/core2.pyx" + __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_arranged_links, __pyx_v_c, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 931, __pyx_L1_error) + +# line 931 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 931 "core/core2.pyx" + __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_a); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 931, __pyx_L1_error) + +# line 931 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_10); + +# line 931 "core/core2.pyx" + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_b); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 931, __pyx_L1_error) + +# line 931 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 931 "core/core2.pyx" + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 931, __pyx_L1_error) + +# line 931 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 931 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_10); + +# line 931 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); + +# line 931 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_9); + +# line 931 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9); + +# line 931 "core/core2.pyx" + __pyx_t_10 = 0; + +# line 931 "core/core2.pyx" + __pyx_t_9 = 0; + +# line 931 "core/core2.pyx" + __pyx_t_13 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 931, __pyx_L1_error) + +# line 931 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 931 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "core/core2.pyx":930 + * cdef int c, a, b, i, j, n + * + * for c, a, b in links: # <<<<<<<<<<<<<< + * arranged_links[c].append((a, b)) + * + */ + +# line 930 "core/core2.pyx" + } + +# line 930 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "core/core2.pyx":936 + * cdef vec3 avg, d + * + * for i in range(engine.n_verts): # <<<<<<<<<<<<<< + * links_lst = arranged_links[i] + * if i > 0: + */ + +# line 936 "core/core2.pyx" + __pyx_t_6 = __pyx_v_engine->n_verts; + +# line 936 "core/core2.pyx" + __pyx_t_5 = __pyx_t_6; + +# line 936 "core/core2.pyx" + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) { + +# line 936 "core/core2.pyx" + __pyx_v_i = __pyx_t_4; + + /* "core/core2.pyx":937 + * + * for i in range(engine.n_verts): + * links_lst = arranged_links[i] # <<<<<<<<<<<<<< + * if i > 0: + * self.links[i] = ((self.links[i - 1]) + sizeof(TernaryLinkArr) + sizeof(TernaryLink) * self.links[i - 1].n) + */ + +# line 937 "core/core2.pyx" + __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_arranged_links, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 937, __pyx_L1_error) + +# line 937 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 937 "core/core2.pyx" + if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 937, __pyx_L1_error) + +# line 937 "core/core2.pyx" + __Pyx_XDECREF_SET(__pyx_v_links_lst, ((PyObject*)__pyx_t_3)); + +# line 937 "core/core2.pyx" + __pyx_t_3 = 0; + + /* "core/core2.pyx":938 + * for i in range(engine.n_verts): + * links_lst = arranged_links[i] + * if i > 0: # <<<<<<<<<<<<<< + * self.links[i] = ((self.links[i - 1]) + sizeof(TernaryLinkArr) + sizeof(TernaryLink) * self.links[i - 1].n) + * + */ + +# line 938 "core/core2.pyx" + __pyx_t_14 = ((__pyx_v_i > 0) != 0); + +# line 938 "core/core2.pyx" + if (__pyx_t_14) { + + /* "core/core2.pyx":939 + * links_lst = arranged_links[i] + * if i > 0: + * self.links[i] = ((self.links[i - 1]) + sizeof(TernaryLinkArr) + sizeof(TernaryLink) * self.links[i - 1].n) # <<<<<<<<<<<<<< + * + * n = len(links_lst) + */ + +# line 939 "core/core2.pyx" + (__pyx_v_self->links[__pyx_v_i]) = ((struct TernaryLinkArr *)((((char *)(__pyx_v_self->links[(__pyx_v_i - 1)])) + (sizeof(struct TernaryLinkArr))) + ((sizeof(struct TernaryLink)) * (__pyx_v_self->links[(__pyx_v_i - 1)])->n))); + + /* "core/core2.pyx":938 + * for i in range(engine.n_verts): + * links_lst = arranged_links[i] + * if i > 0: # <<<<<<<<<<<<<< + * self.links[i] = ((self.links[i - 1]) + sizeof(TernaryLinkArr) + sizeof(TernaryLink) * self.links[i - 1].n) + * + */ + +# line 938 "core/core2.pyx" + } + + /* "core/core2.pyx":941 + * self.links[i] = ((self.links[i - 1]) + sizeof(TernaryLinkArr) + sizeof(TernaryLink) * self.links[i - 1].n) + * + * n = len(links_lst) # <<<<<<<<<<<<<< + * self.links[i].n = n + * + */ + +# line 941 "core/core2.pyx" + if (unlikely(__pyx_v_links_lst == Py_None)) { + +# line 941 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 941 "core/core2.pyx" + __PYX_ERR(0, 941, __pyx_L1_error) + +# line 941 "core/core2.pyx" + } + +# line 941 "core/core2.pyx" + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_links_lst); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 941, __pyx_L1_error) + +# line 941 "core/core2.pyx" + __pyx_v_n = __pyx_t_2; + + /* "core/core2.pyx":942 + * + * n = len(links_lst) + * self.links[i].n = n # <<<<<<<<<<<<<< + * + * for j in range(n): + */ + +# line 942 "core/core2.pyx" + (__pyx_v_self->links[__pyx_v_i])->n = __pyx_v_n; + + /* "core/core2.pyx":944 + * self.links[i].n = n + * + * for j in range(n): # <<<<<<<<<<<<<< + * a, b = links_lst[j] + * self.links[i].arr[j].a = a + */ + +# line 944 "core/core2.pyx" + __pyx_t_15 = __pyx_v_n; + +# line 944 "core/core2.pyx" + __pyx_t_16 = __pyx_t_15; + +# line 944 "core/core2.pyx" + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + +# line 944 "core/core2.pyx" + __pyx_v_j = __pyx_t_17; + + /* "core/core2.pyx":945 + * + * for j in range(n): + * a, b = links_lst[j] # <<<<<<<<<<<<<< + * self.links[i].arr[j].a = a + * self.links[i].arr[j].b = b + */ + +# line 945 "core/core2.pyx" + if (unlikely(__pyx_v_links_lst == Py_None)) { + +# line 945 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 945 "core/core2.pyx" + __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + } + +# line 945 "core/core2.pyx" + __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_links_lst, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 945 "core/core2.pyx" + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + +# line 945 "core/core2.pyx" + PyObject* sequence = __pyx_t_3; + +# line 945 "core/core2.pyx" + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + +# line 945 "core/core2.pyx" + if (unlikely(size != 2)) { + +# line 945 "core/core2.pyx" + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + +# line 945 "core/core2.pyx" + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + +# line 945 "core/core2.pyx" + __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + } + +# line 945 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 945 "core/core2.pyx" + if (likely(PyTuple_CheckExact(sequence))) { + +# line 945 "core/core2.pyx" + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + +# line 945 "core/core2.pyx" + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + +# line 945 "core/core2.pyx" + } else { + +# line 945 "core/core2.pyx" + __pyx_t_8 = PyList_GET_ITEM(sequence, 0); + +# line 945 "core/core2.pyx" + __pyx_t_7 = PyList_GET_ITEM(sequence, 1); + +# line 945 "core/core2.pyx" + } + +# line 945 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_8); + +# line 945 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_7); + +# line 945 "core/core2.pyx" + #else + +# line 945 "core/core2.pyx" + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 945 "core/core2.pyx" + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 945 "core/core2.pyx" + #endif + +# line 945 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 945 "core/core2.pyx" + } else { + +# line 945 "core/core2.pyx" + Py_ssize_t index = -1; + +# line 945 "core/core2.pyx" + __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 945 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 945 "core/core2.pyx" + __pyx_t_12 = Py_TYPE(__pyx_t_9)->tp_iternext; + +# line 945 "core/core2.pyx" + index = 0; __pyx_t_8 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L14_unpacking_failed; + +# line 945 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 945 "core/core2.pyx" + index = 1; __pyx_t_7 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L14_unpacking_failed; + +# line 945 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 945 "core/core2.pyx" + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_9), 2) < 0) __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + __pyx_t_12 = NULL; + +# line 945 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + +# line 945 "core/core2.pyx" + goto __pyx_L15_unpacking_done; + +# line 945 "core/core2.pyx" + __pyx_L14_unpacking_failed:; + +# line 945 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + +# line 945 "core/core2.pyx" + __pyx_t_12 = NULL; + +# line 945 "core/core2.pyx" + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + +# line 945 "core/core2.pyx" + __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + __pyx_L15_unpacking_done:; + +# line 945 "core/core2.pyx" + } + +# line 945 "core/core2.pyx" + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + +# line 945 "core/core2.pyx" + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L1_error) + +# line 945 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 945 "core/core2.pyx" + __pyx_v_a = __pyx_t_18; + +# line 945 "core/core2.pyx" + __pyx_v_b = __pyx_t_19; + + /* "core/core2.pyx":946 + * for j in range(n): + * a, b = links_lst[j] + * self.links[i].arr[j].a = a # <<<<<<<<<<<<<< + * self.links[i].arr[j].b = b + * + */ + +# line 946 "core/core2.pyx" + ((__pyx_v_self->links[__pyx_v_i])->arr[__pyx_v_j]).a = __pyx_v_a; + + /* "core/core2.pyx":947 + * a, b = links_lst[j] + * self.links[i].arr[j].a = a + * self.links[i].arr[j].b = b # <<<<<<<<<<<<<< + * + * + */ + +# line 947 "core/core2.pyx" + ((__pyx_v_self->links[__pyx_v_i])->arr[__pyx_v_j]).b = __pyx_v_b; + +# line 947 "core/core2.pyx" + } + +# line 947 "core/core2.pyx" + } + + /* "core/core2.pyx":920 + * + * @cython.boundscheck(True) + * def __cinit__(self, SpringEngine engine, list links): # <<<<<<<<<<<<<< + * self.engine = engine + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("softwrap_core2.TernarySmoothingLinks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_arranged_links); + __Pyx_XDECREF(__pyx_v_links_lst); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":950 + * + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.links[0]) + * fraeee(self.links) + */ + +/* Python wrapper */ +static void __pyx_pw_14softwrap_core2_21TernarySmoothingLinks_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_14softwrap_core2_21TernarySmoothingLinks_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_14softwrap_core2_21TernarySmoothingLinks_2__dealloc__(((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_14softwrap_core2_21TernarySmoothingLinks_2__dealloc__(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "core/core2.pyx":951 + * + * def __dealloc__(self): + * fraeee(self.links[0]) # <<<<<<<<<<<<<< + * fraeee(self.links) + * + */ + +# line 951 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee((__pyx_v_self->links[0])); + + /* "core/core2.pyx":952 + * def __dealloc__(self): + * fraeee(self.links[0]) + * fraeee(self.links) # <<<<<<<<<<<<<< + * + * cpdef void displacements_update(self): + */ + +# line 952 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->links); + + /* "core/core2.pyx":950 + * + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.links[0]) + * fraeee(self.links) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "core/core2.pyx":954 + * fraeee(self.links) + * + * cpdef void displacements_update(self): # <<<<<<<<<<<<<< + * cdef int i, j, a, b + * cdef vec3 avg, d + */ + +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_5displacements_update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacements_update(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_a; + int __pyx_v_b; + vec3 __pyx_v_avg; + vec3 __pyx_v_d; + struct TernaryLinkArr *__pyx_v_arr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + __Pyx_RefNannySetupContext("displacements_update", 0); + + /* "core/core2.pyx":959 + * cdef TernaryLinkArr* arr + * + * self.engine.m.update_face_normals() # <<<<<<<<<<<<<< + * self.engine.m.update_vert_normals() + * + */ + +# line 959 "core/core2.pyx" + __pyx_f_14softwrap_core2_4Mesh_update_face_normals(__pyx_v_self->engine->m, 0); + + /* "core/core2.pyx":960 + * + * self.engine.m.update_face_normals() + * self.engine.m.update_vert_normals() # <<<<<<<<<<<<<< + * + * for i in range(self.engine.n_verts): + */ + +# line 960 "core/core2.pyx" + __pyx_f_14softwrap_core2_4Mesh_update_vert_normals(__pyx_v_self->engine->m, 0); + + /* "core/core2.pyx":962 + * self.engine.m.update_vert_normals() + * + * for i in range(self.engine.n_verts): # <<<<<<<<<<<<<< + * arr = self.links[i] + * + */ + +# line 962 "core/core2.pyx" + __pyx_t_1 = __pyx_v_self->engine->n_verts; + +# line 962 "core/core2.pyx" + __pyx_t_2 = __pyx_t_1; + +# line 962 "core/core2.pyx" + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + +# line 962 "core/core2.pyx" + __pyx_v_i = __pyx_t_3; + + /* "core/core2.pyx":963 + * + * for i in range(self.engine.n_verts): + * arr = self.links[i] # <<<<<<<<<<<<<< + * + * for j in range(arr.n): + */ + +# line 963 "core/core2.pyx" + __pyx_v_arr = (__pyx_v_self->links[__pyx_v_i]); + + /* "core/core2.pyx":965 + * arr = self.links[i] + * + * for j in range(arr.n): # <<<<<<<<<<<<<< + * a = arr.arr[j].a + * b = arr.arr[j].b + */ + +# line 965 "core/core2.pyx" + __pyx_t_4 = __pyx_v_arr->n; + +# line 965 "core/core2.pyx" + __pyx_t_5 = __pyx_t_4; + +# line 965 "core/core2.pyx" + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + +# line 965 "core/core2.pyx" + __pyx_v_j = __pyx_t_6; + + /* "core/core2.pyx":966 + * + * for j in range(arr.n): + * a = arr.arr[j].a # <<<<<<<<<<<<<< + * b = arr.arr[j].b + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + */ + +# line 966 "core/core2.pyx" + __pyx_t_7 = (__pyx_v_arr->arr[__pyx_v_j]).a; + +# line 966 "core/core2.pyx" + __pyx_v_a = __pyx_t_7; + + /* "core/core2.pyx":967 + * for j in range(arr.n): + * a = arr.arr[j].a + * b = arr.arr[j].b # <<<<<<<<<<<<<< + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + * d = (self.engine.m.verts[i] - avg) + */ + +# line 967 "core/core2.pyx" + __pyx_t_7 = (__pyx_v_arr->arr[__pyx_v_j]).b; + +# line 967 "core/core2.pyx" + __pyx_v_b = __pyx_t_7; + + /* "core/core2.pyx":968 + * a = arr.arr[j].a + * b = arr.arr[j].b + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 # <<<<<<<<<<<<<< + * d = (self.engine.m.verts[i] - avg) + * arr.arr[j].side = d.dot(self.engine.m.vert_normals[i]) > 0 + */ + +# line 968 "core/core2.pyx" + __pyx_v_avg = (((__pyx_v_self->engine->m->verts[__pyx_v_a]) + (__pyx_v_self->engine->m->verts[__pyx_v_b])) * 0.5); + + /* "core/core2.pyx":969 + * b = arr.arr[j].b + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + * d = (self.engine.m.verts[i] - avg) # <<<<<<<<<<<<<< + * arr.arr[j].side = d.dot(self.engine.m.vert_normals[i]) > 0 + * arr.arr[j].avg_dist = d.len() / ((self.engine.m.verts[a] - self.engine.m.verts[b]).len() + EPS) + */ + +# line 969 "core/core2.pyx" + __pyx_v_d = ((__pyx_v_self->engine->m->verts[__pyx_v_i]) - __pyx_v_avg); + + /* "core/core2.pyx":970 + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + * d = (self.engine.m.verts[i] - avg) + * arr.arr[j].side = d.dot(self.engine.m.vert_normals[i]) > 0 # <<<<<<<<<<<<<< + * arr.arr[j].avg_dist = d.len() / ((self.engine.m.verts[a] - self.engine.m.verts[b]).len() + EPS) + * + */ + +# line 970 "core/core2.pyx" + (__pyx_v_arr->arr[__pyx_v_j]).side = (__pyx_v_d.dot((__pyx_v_self->engine->m->vert_normals[__pyx_v_i])) > 0.0); + + /* "core/core2.pyx":971 + * d = (self.engine.m.verts[i] - avg) + * arr.arr[j].side = d.dot(self.engine.m.vert_normals[i]) > 0 + * arr.arr[j].avg_dist = d.len() / ((self.engine.m.verts[a] - self.engine.m.verts[b]).len() + EPS) # <<<<<<<<<<<<<< + * + * cpdef void displacement_force(self, float factor): + */ + +# line 971 "core/core2.pyx" + (__pyx_v_arr->arr[__pyx_v_j]).avg_dist = (__pyx_v_d.len() / (((__pyx_v_self->engine->m->verts[__pyx_v_a]) - (__pyx_v_self->engine->m->verts[__pyx_v_b])).len() + EPS)); + +# line 971 "core/core2.pyx" + } + +# line 971 "core/core2.pyx" + } + + /* "core/core2.pyx":954 + * fraeee(self.links) + * + * cpdef void displacements_update(self): # <<<<<<<<<<<<<< + * cdef int i, j, a, b + * cdef vec3 avg, d + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_5displacements_update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_5displacements_update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("displacements_update (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_21TernarySmoothingLinks_4displacements_update(((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_4displacements_update(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("displacements_update", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacements_update(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 954, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.TernarySmoothingLinks.displacements_update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":973 + * arr.arr[j].avg_dist = d.len() / ((self.engine.m.verts[a] - self.engine.m.verts[b]).len() + EPS) + * + * cpdef void displacement_force(self, float factor): # <<<<<<<<<<<<<< + * cdef int i, j, a, b + * cdef vec3 avg, d + */ + +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_7displacement_force(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor); /*proto*/ +static void __pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacement_force(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, float __pyx_v_factor, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_a; + int __pyx_v_b; + vec3 __pyx_v_avg; + vec3 __pyx_v_d; + struct TernaryLinkArr *__pyx_v_arr; + float __pyx_v_l; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + __Pyx_RefNannySetupContext("displacement_force", 0); + + /* "core/core2.pyx":980 + * cdef float l + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * arr = self.links[i] + */ + +# line 980 "core/core2.pyx" + { + +# line 980 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 980 "core/core2.pyx" + PyThreadState *_save; + +# line 980 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 980 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 980 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":981 + * + * with nogil: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * arr = self.links[i] + * if arr.n == 0: + */ + +# line 981 "core/core2.pyx" + __pyx_t_1 = __pyx_v_self->engine->n_verts; + +# line 981 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 981 "core/core2.pyx" + { + +# line 981 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 981 "core/core2.pyx" + #undef likely + +# line 981 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 981 "core/core2.pyx" + #endif + +# line 981 "core/core2.pyx" + __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; + +# line 981 "core/core2.pyx" + if (__pyx_t_3 > 0) + +# line 981 "core/core2.pyx" + { + +# line 981 "core/core2.pyx" + #ifdef _OPENMP + +# line 981 "core/core2.pyx" + #pragma omp parallel private(__pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_a) lastprivate(__pyx_v_arr) lastprivate(__pyx_v_avg) lastprivate(__pyx_v_b) lastprivate(__pyx_v_d) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) + #endif /* _OPENMP */ + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_2); + /* Initialize private variables to invalid values */ + __pyx_v_a = ((int)0xbad0bad0); + __pyx_v_arr = ((struct TernaryLinkArr *)1); + __pyx_v_b = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_l = ((float)__PYX_NAN()); + + /* "core/core2.pyx":982 + * with nogil: + * for i in prange(self.engine.n_verts): + * arr = self.links[i] # <<<<<<<<<<<<<< + * if arr.n == 0: + * continue + */ + +# line 982 "core/core2.pyx" + __pyx_v_arr = (__pyx_v_self->links[__pyx_v_i]); + + /* "core/core2.pyx":983 + * for i in prange(self.engine.n_verts): + * arr = self.links[i] + * if arr.n == 0: # <<<<<<<<<<<<<< + * continue + * + */ + +# line 983 "core/core2.pyx" + __pyx_t_4 = ((__pyx_v_arr->n == 0) != 0); + +# line 983 "core/core2.pyx" + if (__pyx_t_4) { + + /* "core/core2.pyx":984 + * arr = self.links[i] + * if arr.n == 0: + * continue # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts[i] = vec3(0) + */ + +# line 984 "core/core2.pyx" + goto __pyx_L6_continue; + + /* "core/core2.pyx":983 + * for i in prange(self.engine.n_verts): + * arr = self.links[i] + * if arr.n == 0: # <<<<<<<<<<<<<< + * continue + * + */ + +# line 983 "core/core2.pyx" + } + + /* "core/core2.pyx":986 + * continue + * + * self.engine.tmp_verts[i] = vec3(0) # <<<<<<<<<<<<<< + * + * for j in range(arr.n): + */ + +# line 986 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) = vec3(0.0); + + /* "core/core2.pyx":988 + * self.engine.tmp_verts[i] = vec3(0) + * + * for j in range(arr.n): # <<<<<<<<<<<<<< + * a = arr.arr[j].a + * b = arr.arr[j].b + */ + +# line 988 "core/core2.pyx" + __pyx_t_5 = __pyx_v_arr->n; + +# line 988 "core/core2.pyx" + __pyx_t_6 = __pyx_t_5; + +# line 988 "core/core2.pyx" + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + +# line 988 "core/core2.pyx" + __pyx_v_j = __pyx_t_7; + + /* "core/core2.pyx":989 + * + * for j in range(arr.n): + * a = arr.arr[j].a # <<<<<<<<<<<<<< + * b = arr.arr[j].b + * + */ + +# line 989 "core/core2.pyx" + __pyx_t_8 = (__pyx_v_arr->arr[__pyx_v_j]).a; + +# line 989 "core/core2.pyx" + __pyx_v_a = __pyx_t_8; + + /* "core/core2.pyx":990 + * for j in range(arr.n): + * a = arr.arr[j].a + * b = arr.arr[j].b # <<<<<<<<<<<<<< + * + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + */ + +# line 990 "core/core2.pyx" + __pyx_t_8 = (__pyx_v_arr->arr[__pyx_v_j]).b; + +# line 990 "core/core2.pyx" + __pyx_v_b = __pyx_t_8; + + /* "core/core2.pyx":992 + * b = arr.arr[j].b + * + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 # <<<<<<<<<<<<<< + * d = (self.engine.m.verts[i] - avg) + * if not (d.dot(self.engine.m.vert_normals[i]) > 0) == arr.arr[j].side: + */ + +# line 992 "core/core2.pyx" + __pyx_v_avg = (((__pyx_v_self->engine->m->verts[__pyx_v_a]) + (__pyx_v_self->engine->m->verts[__pyx_v_b])) * 0.5); + + /* "core/core2.pyx":993 + * + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + * d = (self.engine.m.verts[i] - avg) # <<<<<<<<<<<<<< + * if not (d.dot(self.engine.m.vert_normals[i]) > 0) == arr.arr[j].side: + * d = d - d.project_unit(self.engine.m.vert_normals[i]) * 2 + */ + +# line 993 "core/core2.pyx" + __pyx_v_d = ((__pyx_v_self->engine->m->verts[__pyx_v_i]) - __pyx_v_avg); + + /* "core/core2.pyx":994 + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + * d = (self.engine.m.verts[i] - avg) + * if not (d.dot(self.engine.m.vert_normals[i]) > 0) == arr.arr[j].side: # <<<<<<<<<<<<<< + * d = d - d.project_unit(self.engine.m.vert_normals[i]) * 2 + * l = d.len() + */ + +# line 994 "core/core2.pyx" + __pyx_t_4 = ((!(((__pyx_v_d.dot((__pyx_v_self->engine->m->vert_normals[__pyx_v_i])) > 0.0) == (__pyx_v_arr->arr[__pyx_v_j]).side) != 0)) != 0); + +# line 994 "core/core2.pyx" + if (__pyx_t_4) { + + /* "core/core2.pyx":995 + * d = (self.engine.m.verts[i] - avg) + * if not (d.dot(self.engine.m.vert_normals[i]) > 0) == arr.arr[j].side: + * d = d - d.project_unit(self.engine.m.vert_normals[i]) * 2 # <<<<<<<<<<<<<< + * l = d.len() + * if l > EPS: + */ + +# line 995 "core/core2.pyx" + __pyx_v_d = (__pyx_v_d - (__pyx_v_d.project_unit((__pyx_v_self->engine->m->vert_normals[__pyx_v_i])) * 2.0)); + + /* "core/core2.pyx":994 + * avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + * d = (self.engine.m.verts[i] - avg) + * if not (d.dot(self.engine.m.vert_normals[i]) > 0) == arr.arr[j].side: # <<<<<<<<<<<<<< + * d = d - d.project_unit(self.engine.m.vert_normals[i]) * 2 + * l = d.len() + */ + +# line 994 "core/core2.pyx" + } + + /* "core/core2.pyx":996 + * if not (d.dot(self.engine.m.vert_normals[i]) > 0) == arr.arr[j].side: + * d = d - d.project_unit(self.engine.m.vert_normals[i]) * 2 + * l = d.len() # <<<<<<<<<<<<<< + * if l > EPS: + * l = 1 / l + */ + +# line 996 "core/core2.pyx" + __pyx_v_l = __pyx_v_d.len(); + + /* "core/core2.pyx":997 + * d = d - d.project_unit(self.engine.m.vert_normals[i]) * 2 + * l = d.len() + * if l > EPS: # <<<<<<<<<<<<<< + * l = 1 / l + * d = d * l * arr.arr[j].avg_dist * (self.engine.m.verts[a] - self.engine.m.verts[b]).len() + */ + +# line 997 "core/core2.pyx" + __pyx_t_4 = ((__pyx_v_l > EPS) != 0); + +# line 997 "core/core2.pyx" + if (__pyx_t_4) { + + /* "core/core2.pyx":998 + * l = d.len() + * if l > EPS: + * l = 1 / l # <<<<<<<<<<<<<< + * d = d * l * arr.arr[j].avg_dist * (self.engine.m.verts[a] - self.engine.m.verts[b]).len() + * + */ + +# line 998 "core/core2.pyx" + __pyx_v_l = (1.0 / __pyx_v_l); + + /* "core/core2.pyx":997 + * d = d - d.project_unit(self.engine.m.vert_normals[i]) * 2 + * l = d.len() + * if l > EPS: # <<<<<<<<<<<<<< + * l = 1 / l + * d = d * l * arr.arr[j].avg_dist * (self.engine.m.verts[a] - self.engine.m.verts[b]).len() + */ + +# line 997 "core/core2.pyx" + } + + /* "core/core2.pyx":999 + * if l > EPS: + * l = 1 / l + * d = d * l * arr.arr[j].avg_dist * (self.engine.m.verts[a] - self.engine.m.verts[b]).len() # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts[i] += avg + d + */ + +# line 999 "core/core2.pyx" + __pyx_v_d = (((__pyx_v_d * __pyx_v_l) * (__pyx_v_arr->arr[__pyx_v_j]).avg_dist) * ((__pyx_v_self->engine->m->verts[__pyx_v_a]) - (__pyx_v_self->engine->m->verts[__pyx_v_b])).len()); + + /* "core/core2.pyx":1001 + * d = d * l * arr.arr[j].avg_dist * (self.engine.m.verts[a] - self.engine.m.verts[b]).len() + * + * self.engine.tmp_verts[i] += avg + d # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts[i] *= 1.0 / arr.n + */ + +# line 1001 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) += (__pyx_v_avg + __pyx_v_d); + +# line 1001 "core/core2.pyx" + } + + /* "core/core2.pyx":1003 + * self.engine.tmp_verts[i] += avg + d + * + * self.engine.tmp_verts[i] *= 1.0 / arr.n # <<<<<<<<<<<<<< + * + * for i in prange(self.engine.n_verts): + */ + +# line 1003 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) *= (((float)1.0) / ((float)__pyx_v_arr->n)); + +# line 1003 "core/core2.pyx" + goto __pyx_L16; + +# line 1003 "core/core2.pyx" + __pyx_L6_continue:; + +# line 1003 "core/core2.pyx" + goto __pyx_L16; + +# line 1003 "core/core2.pyx" + __pyx_L16:; + +# line 1003 "core/core2.pyx" + } + +# line 1003 "core/core2.pyx" + } + +# line 1003 "core/core2.pyx" + } + +# line 1003 "core/core2.pyx" + } + +# line 1003 "core/core2.pyx" + } + +# line 1003 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1003 "core/core2.pyx" + #undef likely + +# line 1003 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1003 "core/core2.pyx" + #endif + + /* "core/core2.pyx":1005 + * self.engine.tmp_verts[i] *= 1.0 / arr.n + * + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * if self.links[i].n == 0: + * continue + */ + +# line 1005 "core/core2.pyx" + __pyx_t_3 = __pyx_v_self->engine->n_verts; + +# line 1005 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1005 "core/core2.pyx" + { + +# line 1005 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1005 "core/core2.pyx" + #undef likely + +# line 1005 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1005 "core/core2.pyx" + #endif + +# line 1005 "core/core2.pyx" + __pyx_t_1 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + +# line 1005 "core/core2.pyx" + if (__pyx_t_1 > 0) + +# line 1005 "core/core2.pyx" + { + +# line 1005 "core/core2.pyx" + #ifdef _OPENMP + +# line 1005 "core/core2.pyx" + #pragma omp parallel private(__pyx_t_4) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_2); + + /* "core/core2.pyx":1006 + * + * for i in prange(self.engine.n_verts): + * if self.links[i].n == 0: # <<<<<<<<<<<<<< + * continue + * + */ + +# line 1006 "core/core2.pyx" + __pyx_t_4 = (((__pyx_v_self->links[__pyx_v_i])->n == 0) != 0); + +# line 1006 "core/core2.pyx" + if (__pyx_t_4) { + + /* "core/core2.pyx":1007 + * for i in prange(self.engine.n_verts): + * if self.links[i].n == 0: + * continue # <<<<<<<<<<<<<< + * + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.engine.tmp_verts[i], factor) + */ + +# line 1007 "core/core2.pyx" + goto __pyx_L17_continue; + + /* "core/core2.pyx":1006 + * + * for i in prange(self.engine.n_verts): + * if self.links[i].n == 0: # <<<<<<<<<<<<<< + * continue + * + */ + +# line 1006 "core/core2.pyx" + } + + /* "core/core2.pyx":1009 + * continue + * + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.engine.tmp_verts[i], factor) # <<<<<<<<<<<<<< + * + * + */ + +# line 1009 "core/core2.pyx" + (__pyx_v_self->engine->m->verts[__pyx_v_i]) = (__pyx_v_self->engine->m->verts[__pyx_v_i]).lerp((__pyx_v_self->engine->tmp_verts[__pyx_v_i]), __pyx_v_factor); + +# line 1009 "core/core2.pyx" + goto __pyx_L23; + +# line 1009 "core/core2.pyx" + __pyx_L17_continue:; + +# line 1009 "core/core2.pyx" + goto __pyx_L23; + +# line 1009 "core/core2.pyx" + __pyx_L23:; + +# line 1009 "core/core2.pyx" + } + +# line 1009 "core/core2.pyx" + } + +# line 1009 "core/core2.pyx" + } + +# line 1009 "core/core2.pyx" + } + +# line 1009 "core/core2.pyx" + } + +# line 1009 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1009 "core/core2.pyx" + #undef likely + +# line 1009 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1009 "core/core2.pyx" + #endif + +# line 1009 "core/core2.pyx" + } + + /* "core/core2.pyx":980 + * cdef float l + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * arr = self.links[i] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "core/core2.pyx":973 + * arr.arr[j].avg_dist = d.len() / ((self.engine.m.verts[a] - self.engine.m.verts[b]).len() + EPS) + * + * cpdef void displacement_force(self, float factor): # <<<<<<<<<<<<<< + * cdef int i, j, a, b + * cdef vec3 avg, d + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_7displacement_force(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_7displacement_force(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor) { + float __pyx_v_factor; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("displacement_force (wrapper)", 0); + assert(__pyx_arg_factor); { + __pyx_v_factor = __pyx_PyFloat_AsFloat(__pyx_arg_factor); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 973, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.TernarySmoothingLinks.displacement_force", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_21TernarySmoothingLinks_6displacement_force(((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)__pyx_v_self), ((float)__pyx_v_factor)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_6displacement_force(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, float __pyx_v_factor) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("displacement_force", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacement_force(__pyx_v_self, __pyx_v_factor, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 973, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.TernarySmoothingLinks.displacement_force", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":916 + * @cython.final + * cdef class TernarySmoothingLinks: + * cdef readonly SpringEngine engine # <<<<<<<<<<<<<< + * cdef TernaryLinkArr** links + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_6engine_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_6engine_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_21TernarySmoothingLinks_6engine___get__(((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_6engine___get__(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->engine)); + __pyx_r = ((PyObject *)__pyx_v_self->engine); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_21TernarySmoothingLinks_8__reduce_cython__(((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.TernarySmoothingLinks.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_21TernarySmoothingLinks_10__setstate_cython__(((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_21TernarySmoothingLinks_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.TernarySmoothingLinks.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1024 + * + * @cython.boundscheck(True) + * def __cinit__(self, SpringEngine engine, list links): # <<<<<<<<<<<<<< + * self.engine = engine + * self.n_links = len(links) + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine = 0; + PyObject *__pyx_v_links = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_engine,&__pyx_n_s_links,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_engine)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_links)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 1024, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1024, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)values[0]); + __pyx_v_links = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1024, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.QuaternarySmoothingLinks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_engine), __pyx_ptype_14softwrap_core2_SpringEngine, 1, "engine", 0))) __PYX_ERR(0, 1024, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_links), (&PyList_Type), 1, "links", 1))) __PYX_ERR(0, 1024, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks___cinit__(((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_v_self), __pyx_v_engine, __pyx_v_links); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks___cinit__(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine, PyObject *__pyx_v_links) { + struct __pyx_t_14softwrap_core2_QuaternaryLink *__pyx_v_lnk; + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + void *__pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *(*__pyx_t_12)(PyObject *); + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "core/core2.pyx":1025 + * @cython.boundscheck(True) + * def __cinit__(self, SpringEngine engine, list links): + * self.engine = engine # <<<<<<<<<<<<<< + * self.n_links = len(links) + * self.links = maelloc(sizeof(QuaternaryLink) * self.n_links, __LINE__) + */ + +# line 1025 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_engine)); + +# line 1025 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_engine)); + +# line 1025 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->engine); + +# line 1025 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->engine)); + +# line 1025 "core/core2.pyx" + __pyx_v_self->engine = __pyx_v_engine; + + /* "core/core2.pyx":1026 + * def __cinit__(self, SpringEngine engine, list links): + * self.engine = engine + * self.n_links = len(links) # <<<<<<<<<<<<<< + * self.links = maelloc(sizeof(QuaternaryLink) * self.n_links, __LINE__) + * self.accum_n = caelloc(engine.n_verts, sizeof(int), __LINE__) + */ + +# line 1026 "core/core2.pyx" + if (unlikely(__pyx_v_links == Py_None)) { + +# line 1026 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1026 "core/core2.pyx" + __PYX_ERR(0, 1026, __pyx_L1_error) + +# line 1026 "core/core2.pyx" + } + +# line 1026 "core/core2.pyx" + __pyx_t_1 = PyList_GET_SIZE(__pyx_v_links); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1026, __pyx_L1_error) + +# line 1026 "core/core2.pyx" + __pyx_v_self->n_links = __pyx_t_1; + + /* "core/core2.pyx":1027 + * self.engine = engine + * self.n_links = len(links) + * self.links = maelloc(sizeof(QuaternaryLink) * self.n_links, __LINE__) # <<<<<<<<<<<<<< + * self.accum_n = caelloc(engine.n_verts, sizeof(int), __LINE__) + * + */ + +# line 1027 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_maelloc(((sizeof(struct __pyx_t_14softwrap_core2_QuaternaryLink)) * __pyx_v_self->n_links), __LINE__); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 1027, __pyx_L1_error) + +# line 1027 "core/core2.pyx" + __pyx_v_self->links = ((struct __pyx_t_14softwrap_core2_QuaternaryLink *)__pyx_t_2); + + /* "core/core2.pyx":1028 + * self.n_links = len(links) + * self.links = maelloc(sizeof(QuaternaryLink) * self.n_links, __LINE__) + * self.accum_n = caelloc(engine.n_verts, sizeof(int), __LINE__) # <<<<<<<<<<<<<< + * + * cdef QuaternaryLink* lnk + */ + +# line 1028 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_caelloc(__pyx_v_engine->n_verts, (sizeof(int)), __LINE__); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 1028, __pyx_L1_error) + +# line 1028 "core/core2.pyx" + __pyx_v_self->accum_n = ((int *)__pyx_t_2); + + /* "core/core2.pyx":1033 + * cdef int i + * + * for i in range(self.n_links): # <<<<<<<<<<<<<< + * lnk = self.links + i + * lnk.a, lnk.b, lnk.c, lnk.d = links[i] + */ + +# line 1033 "core/core2.pyx" + __pyx_t_3 = __pyx_v_self->n_links; + +# line 1033 "core/core2.pyx" + __pyx_t_4 = __pyx_t_3; + +# line 1033 "core/core2.pyx" + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + +# line 1033 "core/core2.pyx" + __pyx_v_i = __pyx_t_5; + + /* "core/core2.pyx":1034 + * + * for i in range(self.n_links): + * lnk = self.links + i # <<<<<<<<<<<<<< + * lnk.a, lnk.b, lnk.c, lnk.d = links[i] + * index_check(lnk.a, engine.n_verts) + */ + +# line 1034 "core/core2.pyx" + __pyx_v_lnk = (__pyx_v_self->links + __pyx_v_i); + + /* "core/core2.pyx":1035 + * for i in range(self.n_links): + * lnk = self.links + i + * lnk.a, lnk.b, lnk.c, lnk.d = links[i] # <<<<<<<<<<<<<< + * index_check(lnk.a, engine.n_verts) + * index_check(lnk.b, engine.n_verts) + */ + +# line 1035 "core/core2.pyx" + if (unlikely(__pyx_v_links == Py_None)) { + +# line 1035 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1035 "core/core2.pyx" + __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + } + +# line 1035 "core/core2.pyx" + __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_links, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_6); + +# line 1035 "core/core2.pyx" + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + +# line 1035 "core/core2.pyx" + PyObject* sequence = __pyx_t_6; + +# line 1035 "core/core2.pyx" + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + +# line 1035 "core/core2.pyx" + if (unlikely(size != 4)) { + +# line 1035 "core/core2.pyx" + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + +# line 1035 "core/core2.pyx" + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + +# line 1035 "core/core2.pyx" + __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + } + +# line 1035 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 1035 "core/core2.pyx" + if (likely(PyTuple_CheckExact(sequence))) { + +# line 1035 "core/core2.pyx" + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); + +# line 1035 "core/core2.pyx" + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + +# line 1035 "core/core2.pyx" + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); + +# line 1035 "core/core2.pyx" + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); + +# line 1035 "core/core2.pyx" + } else { + +# line 1035 "core/core2.pyx" + __pyx_t_7 = PyList_GET_ITEM(sequence, 0); + +# line 1035 "core/core2.pyx" + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + +# line 1035 "core/core2.pyx" + __pyx_t_9 = PyList_GET_ITEM(sequence, 2); + +# line 1035 "core/core2.pyx" + __pyx_t_10 = PyList_GET_ITEM(sequence, 3); + +# line 1035 "core/core2.pyx" + } + +# line 1035 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_7); + +# line 1035 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_8); + +# line 1035 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_9); + +# line 1035 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_10); + +# line 1035 "core/core2.pyx" + #else + +# line 1035 "core/core2.pyx" + { + +# line 1035 "core/core2.pyx" + Py_ssize_t i; + +# line 1035 "core/core2.pyx" + PyObject** temps[4] = {&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10}; + +# line 1035 "core/core2.pyx" + for (i=0; i < 4; i++) { + +# line 1035 "core/core2.pyx" + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + __Pyx_GOTREF(item); + +# line 1035 "core/core2.pyx" + *(temps[i]) = item; + +# line 1035 "core/core2.pyx" + } + +# line 1035 "core/core2.pyx" + } + +# line 1035 "core/core2.pyx" + #endif + +# line 1035 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + +# line 1035 "core/core2.pyx" + } else { + +# line 1035 "core/core2.pyx" + Py_ssize_t index = -1; + +# line 1035 "core/core2.pyx" + PyObject** temps[4] = {&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10}; + +# line 1035 "core/core2.pyx" + __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_11); + +# line 1035 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + +# line 1035 "core/core2.pyx" + __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; + +# line 1035 "core/core2.pyx" + for (index=0; index < 4; index++) { + +# line 1035 "core/core2.pyx" + PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L5_unpacking_failed; + +# line 1035 "core/core2.pyx" + __Pyx_GOTREF(item); + +# line 1035 "core/core2.pyx" + *(temps[index]) = item; + +# line 1035 "core/core2.pyx" + } + +# line 1035 "core/core2.pyx" + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 4) < 0) __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + __pyx_t_12 = NULL; + +# line 1035 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + +# line 1035 "core/core2.pyx" + goto __pyx_L6_unpacking_done; + +# line 1035 "core/core2.pyx" + __pyx_L5_unpacking_failed:; + +# line 1035 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + +# line 1035 "core/core2.pyx" + __pyx_t_12 = NULL; + +# line 1035 "core/core2.pyx" + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + +# line 1035 "core/core2.pyx" + __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + __pyx_L6_unpacking_done:; + +# line 1035 "core/core2.pyx" + } + +# line 1035 "core/core2.pyx" + __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 1035 "core/core2.pyx" + __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + +# line 1035 "core/core2.pyx" + __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + +# line 1035 "core/core2.pyx" + __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error) + +# line 1035 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + +# line 1035 "core/core2.pyx" + __pyx_v_lnk->a = __pyx_t_13; + +# line 1035 "core/core2.pyx" + __pyx_v_lnk->b = __pyx_t_14; + +# line 1035 "core/core2.pyx" + __pyx_v_lnk->c = __pyx_t_15; + +# line 1035 "core/core2.pyx" + __pyx_v_lnk->d = __pyx_t_16; + + /* "core/core2.pyx":1036 + * lnk = self.links + i + * lnk.a, lnk.b, lnk.c, lnk.d = links[i] + * index_check(lnk.a, engine.n_verts) # <<<<<<<<<<<<<< + * index_check(lnk.b, engine.n_verts) + * index_check(lnk.c, engine.n_verts) + */ + +# line 1036 "core/core2.pyx" + __pyx_t_6 = __pyx_f_14softwrap_core2_index_check(__pyx_v_lnk->a, __pyx_v_engine->n_verts, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1036, __pyx_L1_error) + +# line 1036 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_6); + +# line 1036 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "core/core2.pyx":1037 + * lnk.a, lnk.b, lnk.c, lnk.d = links[i] + * index_check(lnk.a, engine.n_verts) + * index_check(lnk.b, engine.n_verts) # <<<<<<<<<<<<<< + * index_check(lnk.c, engine.n_verts) + * index_check(lnk.d, engine.n_verts) + */ + +# line 1037 "core/core2.pyx" + __pyx_t_6 = __pyx_f_14softwrap_core2_index_check(__pyx_v_lnk->b, __pyx_v_engine->n_verts, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1037, __pyx_L1_error) + +# line 1037 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_6); + +# line 1037 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "core/core2.pyx":1038 + * index_check(lnk.a, engine.n_verts) + * index_check(lnk.b, engine.n_verts) + * index_check(lnk.c, engine.n_verts) # <<<<<<<<<<<<<< + * index_check(lnk.d, engine.n_verts) + * self.accum_n[lnk.a] += 1 + */ + +# line 1038 "core/core2.pyx" + __pyx_t_6 = __pyx_f_14softwrap_core2_index_check(__pyx_v_lnk->c, __pyx_v_engine->n_verts, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error) + +# line 1038 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_6); + +# line 1038 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "core/core2.pyx":1039 + * index_check(lnk.b, engine.n_verts) + * index_check(lnk.c, engine.n_verts) + * index_check(lnk.d, engine.n_verts) # <<<<<<<<<<<<<< + * self.accum_n[lnk.a] += 1 + * self.accum_n[lnk.b] += 1 + */ + +# line 1039 "core/core2.pyx" + __pyx_t_6 = __pyx_f_14softwrap_core2_index_check(__pyx_v_lnk->d, __pyx_v_engine->n_verts, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1039, __pyx_L1_error) + +# line 1039 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_6); + +# line 1039 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "core/core2.pyx":1040 + * index_check(lnk.c, engine.n_verts) + * index_check(lnk.d, engine.n_verts) + * self.accum_n[lnk.a] += 1 # <<<<<<<<<<<<<< + * self.accum_n[lnk.b] += 1 + * self.accum_n[lnk.c] += 1 + */ + +# line 1040 "core/core2.pyx" + __pyx_t_16 = __pyx_v_lnk->a; + +# line 1040 "core/core2.pyx" + (__pyx_v_self->accum_n[__pyx_t_16]) = ((__pyx_v_self->accum_n[__pyx_t_16]) + 1); + + /* "core/core2.pyx":1041 + * index_check(lnk.d, engine.n_verts) + * self.accum_n[lnk.a] += 1 + * self.accum_n[lnk.b] += 1 # <<<<<<<<<<<<<< + * self.accum_n[lnk.c] += 1 + * self.accum_n[lnk.d] += 1 + */ + +# line 1041 "core/core2.pyx" + __pyx_t_16 = __pyx_v_lnk->b; + +# line 1041 "core/core2.pyx" + (__pyx_v_self->accum_n[__pyx_t_16]) = ((__pyx_v_self->accum_n[__pyx_t_16]) + 1); + + /* "core/core2.pyx":1042 + * self.accum_n[lnk.a] += 1 + * self.accum_n[lnk.b] += 1 + * self.accum_n[lnk.c] += 1 # <<<<<<<<<<<<<< + * self.accum_n[lnk.d] += 1 + * + */ + +# line 1042 "core/core2.pyx" + __pyx_t_16 = __pyx_v_lnk->c; + +# line 1042 "core/core2.pyx" + (__pyx_v_self->accum_n[__pyx_t_16]) = ((__pyx_v_self->accum_n[__pyx_t_16]) + 1); + + /* "core/core2.pyx":1043 + * self.accum_n[lnk.b] += 1 + * self.accum_n[lnk.c] += 1 + * self.accum_n[lnk.d] += 1 # <<<<<<<<<<<<<< + * + * for i in range(engine.n_verts): + */ + +# line 1043 "core/core2.pyx" + __pyx_t_16 = __pyx_v_lnk->d; + +# line 1043 "core/core2.pyx" + (__pyx_v_self->accum_n[__pyx_t_16]) = ((__pyx_v_self->accum_n[__pyx_t_16]) + 1); + +# line 1043 "core/core2.pyx" + } + + /* "core/core2.pyx":1045 + * self.accum_n[lnk.d] += 1 + * + * for i in range(engine.n_verts): # <<<<<<<<<<<<<< + * if self.accum_n[i] == 0: + * self.accum_n[i] = 1 + */ + +# line 1045 "core/core2.pyx" + __pyx_t_3 = __pyx_v_engine->n_verts; + +# line 1045 "core/core2.pyx" + __pyx_t_4 = __pyx_t_3; + +# line 1045 "core/core2.pyx" + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + +# line 1045 "core/core2.pyx" + __pyx_v_i = __pyx_t_5; + + /* "core/core2.pyx":1046 + * + * for i in range(engine.n_verts): + * if self.accum_n[i] == 0: # <<<<<<<<<<<<<< + * self.accum_n[i] = 1 + * + */ + +# line 1046 "core/core2.pyx" + __pyx_t_17 = (((__pyx_v_self->accum_n[__pyx_v_i]) == 0) != 0); + +# line 1046 "core/core2.pyx" + if (__pyx_t_17) { + + /* "core/core2.pyx":1047 + * for i in range(engine.n_verts): + * if self.accum_n[i] == 0: + * self.accum_n[i] = 1 # <<<<<<<<<<<<<< + * + * self.lengths_update() + */ + +# line 1047 "core/core2.pyx" + (__pyx_v_self->accum_n[__pyx_v_i]) = 1; + + /* "core/core2.pyx":1046 + * + * for i in range(engine.n_verts): + * if self.accum_n[i] == 0: # <<<<<<<<<<<<<< + * self.accum_n[i] = 1 + * + */ + +# line 1046 "core/core2.pyx" + } + +# line 1046 "core/core2.pyx" + } + + /* "core/core2.pyx":1049 + * self.accum_n[i] = 1 + * + * self.lengths_update() # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + +# line 1049 "core/core2.pyx" + ((struct __pyx_vtabstruct_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_v_self->__pyx_vtab)->lengths_update(__pyx_v_self, 0); + + /* "core/core2.pyx":1024 + * + * @cython.boundscheck(True) + * def __cinit__(self, SpringEngine engine, list links): # <<<<<<<<<<<<<< + * self.engine = engine + * self.n_links = len(links) + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("softwrap_core2.QuaternarySmoothingLinks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1051 + * self.lengths_update() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.links) + * fraeee(self.accum_n) + */ + +/* Python wrapper */ +static void __pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_2__dealloc__(((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_2__dealloc__(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "core/core2.pyx":1052 + * + * def __dealloc__(self): + * fraeee(self.links) # <<<<<<<<<<<<<< + * fraeee(self.accum_n) + * + */ + +# line 1052 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->links); + + /* "core/core2.pyx":1053 + * def __dealloc__(self): + * fraeee(self.links) + * fraeee(self.accum_n) # <<<<<<<<<<<<<< + * + * cpdef void lengths_update(self): + */ + +# line 1053 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->accum_n); + + /* "core/core2.pyx":1051 + * self.lengths_update() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.links) + * fraeee(self.accum_n) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "core/core2.pyx":1055 + * fraeee(self.accum_n) + * + * cpdef void lengths_update(self): # <<<<<<<<<<<<<< + * + * cdef int i + */ + +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_5lengths_update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_14softwrap_core2_24QuaternarySmoothingLinks_lengths_update(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_v_i; + struct __pyx_t_14softwrap_core2_QuaternaryLink *__pyx_v_lnk; + vec3 __pyx_v_ab; + vec3 __pyx_v_cd; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lengths_update", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lengths_update); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1055, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_5lengths_update)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1055, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1061 + * cdef vec3 ab, cd + * + * for i in range(self.n_links): # <<<<<<<<<<<<<< + * lnk = self.links + i + * ab = (self.engine.m.verts[lnk.a] - self.engine.m.verts[lnk.b]) + */ + +# line 1061 "core/core2.pyx" + __pyx_t_5 = __pyx_v_self->n_links; + +# line 1061 "core/core2.pyx" + __pyx_t_6 = __pyx_t_5; + +# line 1061 "core/core2.pyx" + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + +# line 1061 "core/core2.pyx" + __pyx_v_i = __pyx_t_7; + + /* "core/core2.pyx":1062 + * + * for i in range(self.n_links): + * lnk = self.links + i # <<<<<<<<<<<<<< + * ab = (self.engine.m.verts[lnk.a] - self.engine.m.verts[lnk.b]) + * cd = (self.engine.m.verts[lnk.c] - self.engine.m.verts[lnk.d]) + */ + +# line 1062 "core/core2.pyx" + __pyx_v_lnk = (__pyx_v_self->links + __pyx_v_i); + + /* "core/core2.pyx":1063 + * for i in range(self.n_links): + * lnk = self.links + i + * ab = (self.engine.m.verts[lnk.a] - self.engine.m.verts[lnk.b]) # <<<<<<<<<<<<<< + * cd = (self.engine.m.verts[lnk.c] - self.engine.m.verts[lnk.d]) + * + */ + +# line 1063 "core/core2.pyx" + __pyx_v_ab = ((__pyx_v_self->engine->m->verts[__pyx_v_lnk->a]) - (__pyx_v_self->engine->m->verts[__pyx_v_lnk->b])); + + /* "core/core2.pyx":1064 + * lnk = self.links + i + * ab = (self.engine.m.verts[lnk.a] - self.engine.m.verts[lnk.b]) + * cd = (self.engine.m.verts[lnk.c] - self.engine.m.verts[lnk.d]) # <<<<<<<<<<<<<< + * + * lnk.ratio = ab.len() / cd.len() + */ + +# line 1064 "core/core2.pyx" + __pyx_v_cd = ((__pyx_v_self->engine->m->verts[__pyx_v_lnk->c]) - (__pyx_v_self->engine->m->verts[__pyx_v_lnk->d])); + + /* "core/core2.pyx":1066 + * cd = (self.engine.m.verts[lnk.c] - self.engine.m.verts[lnk.d]) + * + * lnk.ratio = ab.len() / cd.len() # <<<<<<<<<<<<<< + * lnk.side = ab.dot(cd) > 1 + * + */ + +# line 1066 "core/core2.pyx" + __pyx_v_lnk->ratio = (__pyx_v_ab.len() / __pyx_v_cd.len()); + + /* "core/core2.pyx":1067 + * + * lnk.ratio = ab.len() / cd.len() + * lnk.side = ab.dot(cd) > 1 # <<<<<<<<<<<<<< + * + * cpdef void smooth(self, float factor, float max_ratio=3): + */ + +# line 1067 "core/core2.pyx" + __pyx_v_lnk->side = (__pyx_v_ab.dot(__pyx_v_cd) > 1.0); + +# line 1067 "core/core2.pyx" + } + + /* "core/core2.pyx":1055 + * fraeee(self.accum_n) + * + * cpdef void lengths_update(self): # <<<<<<<<<<<<<< + * + * cdef int i + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("softwrap_core2.QuaternarySmoothingLinks.lengths_update", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_5lengths_update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_5lengths_update(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lengths_update (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_4lengths_update(((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_4lengths_update(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lengths_update", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_24QuaternarySmoothingLinks_lengths_update(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1055, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.QuaternarySmoothingLinks.lengths_update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1069 + * lnk.side = ab.dot(cd) > 1 + * + * cpdef void smooth(self, float factor, float max_ratio=3): # <<<<<<<<<<<<<< + * cdef int i + * cdef QuaternaryLink* lnk + */ + +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_7smooth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_14softwrap_core2_24QuaternarySmoothingLinks_smooth(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_24QuaternarySmoothingLinks_smooth *__pyx_optional_args) { + float __pyx_v_max_ratio = ((float)3.0); + int __pyx_v_i; + struct __pyx_t_14softwrap_core2_QuaternaryLink *__pyx_v_lnk; + vec3 __pyx_v_ab; + vec3 __pyx_v_cd; + float __pyx_v_lab; + float __pyx_v_lcd; + float __pyx_v_rlab; + float __pyx_v_rlcd; + float __pyx_v_min_ratio; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("smooth", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_max_ratio = __pyx_optional_args->max_ratio; + } + } + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_smooth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_7smooth)) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_factor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_max_ratio); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1074 + * cdef vec3 ab, cd + * cdef float lab, lcd, rlab, rlcd + * cdef float min_ratio = 1.0 / max_ratio # <<<<<<<<<<<<<< + * + * for i in range(self.engine.n_verts): + */ + +# line 1074 "core/core2.pyx" + __pyx_v_min_ratio = (((float)1.0) / __pyx_v_max_ratio); + + /* "core/core2.pyx":1076 + * cdef float min_ratio = 1.0 / max_ratio + * + * for i in range(self.engine.n_verts): # <<<<<<<<<<<<<< + * self.engine.tmp_verts[i] = vec3(0) + * + */ + +# line 1076 "core/core2.pyx" + __pyx_t_7 = __pyx_v_self->engine->n_verts; + +# line 1076 "core/core2.pyx" + __pyx_t_9 = __pyx_t_7; + +# line 1076 "core/core2.pyx" + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + +# line 1076 "core/core2.pyx" + __pyx_v_i = __pyx_t_10; + + /* "core/core2.pyx":1077 + * + * for i in range(self.engine.n_verts): + * self.engine.tmp_verts[i] = vec3(0) # <<<<<<<<<<<<<< + * + * for i in range(self.n_links): + */ + +# line 1077 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) = vec3(0.0); + +# line 1077 "core/core2.pyx" + } + + /* "core/core2.pyx":1079 + * self.engine.tmp_verts[i] = vec3(0) + * + * for i in range(self.n_links): # <<<<<<<<<<<<<< + * lnk = self.links + i + * if lnk.ratio < min_ratio or lnk.ratio > max_ratio: + */ + +# line 1079 "core/core2.pyx" + __pyx_t_7 = __pyx_v_self->n_links; + +# line 1079 "core/core2.pyx" + __pyx_t_9 = __pyx_t_7; + +# line 1079 "core/core2.pyx" + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + +# line 1079 "core/core2.pyx" + __pyx_v_i = __pyx_t_10; + + /* "core/core2.pyx":1080 + * + * for i in range(self.n_links): + * lnk = self.links + i # <<<<<<<<<<<<<< + * if lnk.ratio < min_ratio or lnk.ratio > max_ratio: + * continue + */ + +# line 1080 "core/core2.pyx" + __pyx_v_lnk = (__pyx_v_self->links + __pyx_v_i); + + /* "core/core2.pyx":1081 + * for i in range(self.n_links): + * lnk = self.links + i + * if lnk.ratio < min_ratio or lnk.ratio > max_ratio: # <<<<<<<<<<<<<< + * continue + * + */ + +# line 1081 "core/core2.pyx" + __pyx_t_12 = ((__pyx_v_lnk->ratio < __pyx_v_min_ratio) != 0); + +# line 1081 "core/core2.pyx" + if (!__pyx_t_12) { + +# line 1081 "core/core2.pyx" + } else { + +# line 1081 "core/core2.pyx" + __pyx_t_11 = __pyx_t_12; + +# line 1081 "core/core2.pyx" + goto __pyx_L8_bool_binop_done; + +# line 1081 "core/core2.pyx" + } + +# line 1081 "core/core2.pyx" + __pyx_t_12 = ((__pyx_v_lnk->ratio > __pyx_v_max_ratio) != 0); + +# line 1081 "core/core2.pyx" + __pyx_t_11 = __pyx_t_12; + +# line 1081 "core/core2.pyx" + __pyx_L8_bool_binop_done:; + +# line 1081 "core/core2.pyx" + if (__pyx_t_11) { + + /* "core/core2.pyx":1082 + * lnk = self.links + i + * if lnk.ratio < min_ratio or lnk.ratio > max_ratio: + * continue # <<<<<<<<<<<<<< + * + * ab = (self.engine.m.verts[lnk.a] - self.engine.m.verts[lnk.b]) + */ + +# line 1082 "core/core2.pyx" + goto __pyx_L5_continue; + + /* "core/core2.pyx":1081 + * for i in range(self.n_links): + * lnk = self.links + i + * if lnk.ratio < min_ratio or lnk.ratio > max_ratio: # <<<<<<<<<<<<<< + * continue + * + */ + +# line 1081 "core/core2.pyx" + } + + /* "core/core2.pyx":1084 + * continue + * + * ab = (self.engine.m.verts[lnk.a] - self.engine.m.verts[lnk.b]) # <<<<<<<<<<<<<< + * cd = (self.engine.m.verts[lnk.c] - self.engine.m.verts[lnk.d]) + * + */ + +# line 1084 "core/core2.pyx" + __pyx_v_ab = ((__pyx_v_self->engine->m->verts[__pyx_v_lnk->a]) - (__pyx_v_self->engine->m->verts[__pyx_v_lnk->b])); + + /* "core/core2.pyx":1085 + * + * ab = (self.engine.m.verts[lnk.a] - self.engine.m.verts[lnk.b]) + * cd = (self.engine.m.verts[lnk.c] - self.engine.m.verts[lnk.d]) # <<<<<<<<<<<<<< + * + * + */ + +# line 1085 "core/core2.pyx" + __pyx_v_cd = ((__pyx_v_self->engine->m->verts[__pyx_v_lnk->c]) - (__pyx_v_self->engine->m->verts[__pyx_v_lnk->d])); + + /* "core/core2.pyx":1088 + * + * + * rlab = ab.len() # <<<<<<<<<<<<<< + * rlcd = cd.len() + * + */ + +# line 1088 "core/core2.pyx" + __pyx_v_rlab = __pyx_v_ab.len(); + + /* "core/core2.pyx":1089 + * + * rlab = ab.len() + * rlcd = cd.len() # <<<<<<<<<<<<<< + * + * lab = rlcd * lnk.ratio + */ + +# line 1089 "core/core2.pyx" + __pyx_v_rlcd = __pyx_v_cd.len(); + + /* "core/core2.pyx":1091 + * rlcd = cd.len() + * + * lab = rlcd * lnk.ratio # <<<<<<<<<<<<<< + * lcd = rlab / lnk.ratio + * + */ + +# line 1091 "core/core2.pyx" + __pyx_v_lab = (__pyx_v_rlcd * __pyx_v_lnk->ratio); + + /* "core/core2.pyx":1092 + * + * lab = rlcd * lnk.ratio + * lcd = rlab / lnk.ratio # <<<<<<<<<<<<<< + * + * ab -= ab / rlab * lab + */ + +# line 1092 "core/core2.pyx" + __pyx_v_lcd = (__pyx_v_rlab / __pyx_v_lnk->ratio); + + /* "core/core2.pyx":1094 + * lcd = rlab / lnk.ratio + * + * ab -= ab / rlab * lab # <<<<<<<<<<<<<< + * cd -= cd / rlcd * lcd + * + */ + +# line 1094 "core/core2.pyx" + __pyx_v_ab -= ((__pyx_v_ab / __pyx_v_rlab) * __pyx_v_lab); + + /* "core/core2.pyx":1095 + * + * ab -= ab / rlab * lab + * cd -= cd / rlcd * lcd # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts[lnk.a] -= ab + */ + +# line 1095 "core/core2.pyx" + __pyx_v_cd -= ((__pyx_v_cd / __pyx_v_rlcd) * __pyx_v_lcd); + + /* "core/core2.pyx":1097 + * cd -= cd / rlcd * lcd + * + * self.engine.tmp_verts[lnk.a] -= ab # <<<<<<<<<<<<<< + * self.engine.tmp_verts[lnk.b] += ab + * + */ + +# line 1097 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_lnk->a]) -= __pyx_v_ab; + + /* "core/core2.pyx":1098 + * + * self.engine.tmp_verts[lnk.a] -= ab + * self.engine.tmp_verts[lnk.b] += ab # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts[lnk.c] -= cd + */ + +# line 1098 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_lnk->b]) += __pyx_v_ab; + + /* "core/core2.pyx":1100 + * self.engine.tmp_verts[lnk.b] += ab + * + * self.engine.tmp_verts[lnk.c] -= cd # <<<<<<<<<<<<<< + * self.engine.tmp_verts[lnk.d] += cd + * + */ + +# line 1100 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_lnk->c]) -= __pyx_v_cd; + + /* "core/core2.pyx":1101 + * + * self.engine.tmp_verts[lnk.c] -= cd + * self.engine.tmp_verts[lnk.d] += cd # <<<<<<<<<<<<<< + * + * for i in range(self.engine.n_verts): + */ + +# line 1101 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_lnk->d]) += __pyx_v_cd; + +# line 1101 "core/core2.pyx" + __pyx_L5_continue:; + +# line 1101 "core/core2.pyx" + } + + /* "core/core2.pyx":1103 + * self.engine.tmp_verts[lnk.d] += cd + * + * for i in range(self.engine.n_verts): # <<<<<<<<<<<<<< + * self.engine.m.verts[i] += self.engine.tmp_verts[i] * factor / self.accum_n[i] + * + */ + +# line 1103 "core/core2.pyx" + __pyx_t_7 = __pyx_v_self->engine->n_verts; + +# line 1103 "core/core2.pyx" + __pyx_t_9 = __pyx_t_7; + +# line 1103 "core/core2.pyx" + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + +# line 1103 "core/core2.pyx" + __pyx_v_i = __pyx_t_10; + + /* "core/core2.pyx":1104 + * + * for i in range(self.engine.n_verts): + * self.engine.m.verts[i] += self.engine.tmp_verts[i] * factor / self.accum_n[i] # <<<<<<<<<<<<<< + * + * + */ + +# line 1104 "core/core2.pyx" + (__pyx_v_self->engine->m->verts[__pyx_v_i]) += (((__pyx_v_self->engine->tmp_verts[__pyx_v_i]) * __pyx_v_factor) / (__pyx_v_self->accum_n[__pyx_v_i])); + +# line 1104 "core/core2.pyx" + } + + /* "core/core2.pyx":1069 + * lnk.side = ab.dot(cd) > 1 + * + * cpdef void smooth(self, float factor, float max_ratio=3): # <<<<<<<<<<<<<< + * cdef int i + * cdef QuaternaryLink* lnk + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("softwrap_core2.QuaternarySmoothingLinks.smooth", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_7smooth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_7smooth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_factor; + float __pyx_v_max_ratio; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("smooth (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_factor,&__pyx_n_s_max_ratio,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_ratio); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "smooth") < 0)) __PYX_ERR(0, 1069, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_factor = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1069, __pyx_L3_error) + if (values[1]) { + __pyx_v_max_ratio = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_max_ratio == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1069, __pyx_L3_error) + } else { + __pyx_v_max_ratio = ((float)3.0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("smooth", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1069, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.QuaternarySmoothingLinks.smooth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_6smooth(((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_v_self), __pyx_v_factor, __pyx_v_max_ratio); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_6smooth(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, float __pyx_v_factor, float __pyx_v_max_ratio) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_14softwrap_core2_24QuaternarySmoothingLinks_smooth __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("smooth", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1.__pyx_n = 1; + __pyx_t_1.max_ratio = __pyx_v_max_ratio; + __pyx_vtabptr_14softwrap_core2_QuaternarySmoothingLinks->smooth(__pyx_v_self, __pyx_v_factor, 1, &__pyx_t_1); + __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("softwrap_core2.QuaternarySmoothingLinks.smooth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1018 + * + * cdef class QuaternarySmoothingLinks: + * cdef readonly SpringEngine engine # <<<<<<<<<<<<<< + * cdef readonly int n_links + * cdef QuaternaryLink* links + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_6engine_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_6engine_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_6engine___get__(((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_6engine___get__(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->engine)); + __pyx_r = ((PyObject *)__pyx_v_self->engine); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1019 + * cdef class QuaternarySmoothingLinks: + * cdef readonly SpringEngine engine + * cdef readonly int n_links # <<<<<<<<<<<<<< + * cdef QuaternaryLink* links + * cdef int* accum_n + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_7n_links_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_7n_links_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_7n_links___get__(((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_7n_links___get__(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->n_links); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.QuaternarySmoothingLinks.n_links.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_8__reduce_cython__(((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.QuaternarySmoothingLinks.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_10__setstate_cython__(((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_24QuaternarySmoothingLinks_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.QuaternarySmoothingLinks.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1115 + * + * + * def __cinit__(self, SpringLinks links, int start_index, int n_rings): # <<<<<<<<<<<<<< + * n_rings = nmax(n_rings, 1) + * self.engine = links.engine + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_15SpringEnginePin_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_15SpringEnginePin_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_links = 0; + int __pyx_v_start_index; + int __pyx_v_n_rings; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_links,&__pyx_n_s_start_index,&__pyx_n_s_n_rings,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_links)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start_index)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 1115, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_rings)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 1115, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1115, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_links = ((struct __pyx_obj_14softwrap_core2_SpringLinks *)values[0]); + __pyx_v_start_index = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_start_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1115, __pyx_L3_error) + __pyx_v_n_rings = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n_rings == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1115, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1115, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_links), __pyx_ptype_14softwrap_core2_SpringLinks, 1, "links", 0))) __PYX_ERR(0, 1115, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin___cinit__(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self), __pyx_v_links, __pyx_v_start_index, __pyx_v_n_rings); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_15SpringEnginePin___cinit__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_v_links, int __pyx_v_start_index, int __pyx_v_n_rings) { + PyObject *__pyx_v_rings = 0; + PyObject *__pyx_v_seen = 0; + PyObject *__pyx_v_new_front = 0; + struct __pyx_obj_14softwrap_core2_LinkProbe *__pyx_v_probe = 0; + int __pyx_v_i; + int __pyx_v_vert_idx; + PyObject *__pyx_v_new_idx = NULL; + PyObject *__pyx_v_front = 0; + int __pyx_v_j; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + long __pyx_t_5; + long __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + void *__pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "core/core2.pyx":1116 + * + * def __cinit__(self, SpringLinks links, int start_index, int n_rings): + * n_rings = nmax(n_rings, 1) # <<<<<<<<<<<<<< + * self.engine = links.engine + * + */ + +# line 1116 "core/core2.pyx" + __pyx_v_n_rings = nmax(__pyx_v_n_rings, 1); + + /* "core/core2.pyx":1117 + * def __cinit__(self, SpringLinks links, int start_index, int n_rings): + * n_rings = nmax(n_rings, 1) + * self.engine = links.engine # <<<<<<<<<<<<<< + * + * if start_index < 0 or start_index >= self.engine.n_verts: + */ + +# line 1117 "core/core2.pyx" + __pyx_t_1 = ((PyObject *)__pyx_v_links->engine); + +# line 1117 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_1); + +# line 1117 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_1); + +# line 1117 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->engine); + +# line 1117 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->engine)); + +# line 1117 "core/core2.pyx" + __pyx_v_self->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_t_1); + +# line 1117 "core/core2.pyx" + __pyx_t_1 = 0; + + /* "core/core2.pyx":1119 + * self.engine = links.engine + * + * if start_index < 0 or start_index >= self.engine.n_verts: # <<<<<<<<<<<<<< + * raise ValueError('invalid start_index') + * + */ + +# line 1119 "core/core2.pyx" + __pyx_t_3 = ((__pyx_v_start_index < 0) != 0); + +# line 1119 "core/core2.pyx" + if (!__pyx_t_3) { + +# line 1119 "core/core2.pyx" + } else { + +# line 1119 "core/core2.pyx" + __pyx_t_2 = __pyx_t_3; + +# line 1119 "core/core2.pyx" + goto __pyx_L4_bool_binop_done; + +# line 1119 "core/core2.pyx" + } + +# line 1119 "core/core2.pyx" + __pyx_t_3 = ((__pyx_v_start_index >= __pyx_v_self->engine->n_verts) != 0); + +# line 1119 "core/core2.pyx" + __pyx_t_2 = __pyx_t_3; + +# line 1119 "core/core2.pyx" + __pyx_L4_bool_binop_done:; + +# line 1119 "core/core2.pyx" + if (unlikely(__pyx_t_2)) { + + /* "core/core2.pyx":1120 + * + * if start_index < 0 or start_index >= self.engine.n_verts: + * raise ValueError('invalid start_index') # <<<<<<<<<<<<<< + * + * self.start_index = start_index + */ + +# line 1120 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1120, __pyx_L1_error) + +# line 1120 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1120 "core/core2.pyx" + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + +# line 1120 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1120 "core/core2.pyx" + __PYX_ERR(0, 1120, __pyx_L1_error) + + /* "core/core2.pyx":1119 + * self.engine = links.engine + * + * if start_index < 0 or start_index >= self.engine.n_verts: # <<<<<<<<<<<<<< + * raise ValueError('invalid start_index') + * + */ + +# line 1119 "core/core2.pyx" + } + + /* "core/core2.pyx":1122 + * raise ValueError('invalid start_index') + * + * self.start_index = start_index # <<<<<<<<<<<<<< + * + * cdef list rings = [[start_index]] + */ + +# line 1122 "core/core2.pyx" + __pyx_v_self->start_index = __pyx_v_start_index; + + /* "core/core2.pyx":1124 + * self.start_index = start_index + * + * cdef list rings = [[start_index]] # <<<<<<<<<<<<<< + * cdef set seen = set((start_index,)) + * cdef list new_front + */ + +# line 1124 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1124, __pyx_L1_error) + +# line 1124 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1124 "core/core2.pyx" + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1124, __pyx_L1_error) + +# line 1124 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1124 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_1); + +# line 1124 "core/core2.pyx" + PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + +# line 1124 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 1124 "core/core2.pyx" + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1124, __pyx_L1_error) + +# line 1124 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1124 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_4); + +# line 1124 "core/core2.pyx" + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + +# line 1124 "core/core2.pyx" + __pyx_t_4 = 0; + +# line 1124 "core/core2.pyx" + __pyx_v_rings = ((PyObject*)__pyx_t_1); + +# line 1124 "core/core2.pyx" + __pyx_t_1 = 0; + + /* "core/core2.pyx":1125 + * + * cdef list rings = [[start_index]] + * cdef set seen = set((start_index,)) # <<<<<<<<<<<<<< + * cdef list new_front + * cdef LinkProbe probe + */ + +# line 1125 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1125, __pyx_L1_error) + +# line 1125 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1125 "core/core2.pyx" + __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error) + +# line 1125 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1125 "core/core2.pyx" + if (PySet_Add(__pyx_t_4, __pyx_t_1) < 0) __PYX_ERR(0, 1125, __pyx_L1_error) + +# line 1125 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1125 "core/core2.pyx" + __pyx_v_seen = ((PyObject*)__pyx_t_4); + +# line 1125 "core/core2.pyx" + __pyx_t_4 = 0; + + /* "core/core2.pyx":1131 + * cdef int i + * cdef int vert_idx + * for i in range(n_rings - 1): # <<<<<<<<<<<<<< + * new_front = [] + * for vert_idx in rings[-1]: + */ + +# line 1131 "core/core2.pyx" + __pyx_t_5 = (__pyx_v_n_rings - 1); + +# line 1131 "core/core2.pyx" + __pyx_t_6 = __pyx_t_5; + +# line 1131 "core/core2.pyx" + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + +# line 1131 "core/core2.pyx" + __pyx_v_i = __pyx_t_7; + + /* "core/core2.pyx":1132 + * cdef int vert_idx + * for i in range(n_rings - 1): + * new_front = [] # <<<<<<<<<<<<<< + * for vert_idx in rings[-1]: + * probe = links[vert_idx] + */ + +# line 1132 "core/core2.pyx" + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1132, __pyx_L1_error) + +# line 1132 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1132 "core/core2.pyx" + __Pyx_XDECREF_SET(__pyx_v_new_front, ((PyObject*)__pyx_t_4)); + +# line 1132 "core/core2.pyx" + __pyx_t_4 = 0; + + /* "core/core2.pyx":1133 + * for i in range(n_rings - 1): + * new_front = [] + * for vert_idx in rings[-1]: # <<<<<<<<<<<<<< + * probe = links[vert_idx] + * for new_idx in probe: + */ + +# line 1133 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_rings, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1133, __pyx_L1_error) + +# line 1133 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1133 "core/core2.pyx" + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + +# line 1133 "core/core2.pyx" + __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + +# line 1133 "core/core2.pyx" + __pyx_t_9 = NULL; + +# line 1133 "core/core2.pyx" + } else { + +# line 1133 "core/core2.pyx" + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1133, __pyx_L1_error) + +# line 1133 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1133 "core/core2.pyx" + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1133, __pyx_L1_error) + +# line 1133 "core/core2.pyx" + } + +# line 1133 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1133 "core/core2.pyx" + for (;;) { + +# line 1133 "core/core2.pyx" + if (likely(!__pyx_t_9)) { + +# line 1133 "core/core2.pyx" + if (likely(PyList_CheckExact(__pyx_t_1))) { + +# line 1133 "core/core2.pyx" + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + +# line 1133 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 1133 "core/core2.pyx" + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1133, __pyx_L1_error) + +# line 1133 "core/core2.pyx" + #else + +# line 1133 "core/core2.pyx" + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1133, __pyx_L1_error) + +# line 1133 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1133 "core/core2.pyx" + #endif + +# line 1133 "core/core2.pyx" + } else { + +# line 1133 "core/core2.pyx" + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + +# line 1133 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 1133 "core/core2.pyx" + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1133, __pyx_L1_error) + +# line 1133 "core/core2.pyx" + #else + +# line 1133 "core/core2.pyx" + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1133, __pyx_L1_error) + +# line 1133 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1133 "core/core2.pyx" + #endif + +# line 1133 "core/core2.pyx" + } + +# line 1133 "core/core2.pyx" + } else { + +# line 1133 "core/core2.pyx" + __pyx_t_4 = __pyx_t_9(__pyx_t_1); + +# line 1133 "core/core2.pyx" + if (unlikely(!__pyx_t_4)) { + +# line 1133 "core/core2.pyx" + PyObject* exc_type = PyErr_Occurred(); + +# line 1133 "core/core2.pyx" + if (exc_type) { + +# line 1133 "core/core2.pyx" + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + +# line 1133 "core/core2.pyx" + else __PYX_ERR(0, 1133, __pyx_L1_error) + +# line 1133 "core/core2.pyx" + } + +# line 1133 "core/core2.pyx" + break; + +# line 1133 "core/core2.pyx" + } + +# line 1133 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1133 "core/core2.pyx" + } + +# line 1133 "core/core2.pyx" + __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1133, __pyx_L1_error) + +# line 1133 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1133 "core/core2.pyx" + __pyx_v_vert_idx = __pyx_t_10; + + /* "core/core2.pyx":1134 + * new_front = [] + * for vert_idx in rings[-1]: + * probe = links[vert_idx] # <<<<<<<<<<<<<< + * for new_idx in probe: + * if new_idx not in seen: + */ + +# line 1134 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_links), __pyx_v_vert_idx, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1134, __pyx_L1_error) + +# line 1134 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1134 "core/core2.pyx" + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_14softwrap_core2_LinkProbe))))) __PYX_ERR(0, 1134, __pyx_L1_error) + +# line 1134 "core/core2.pyx" + __Pyx_XDECREF_SET(__pyx_v_probe, ((struct __pyx_obj_14softwrap_core2_LinkProbe *)__pyx_t_4)); + +# line 1134 "core/core2.pyx" + __pyx_t_4 = 0; + + /* "core/core2.pyx":1135 + * for vert_idx in rings[-1]: + * probe = links[vert_idx] + * for new_idx in probe: # <<<<<<<<<<<<<< + * if new_idx not in seen: + * seen.add(new_idx) + */ + +# line 1135 "core/core2.pyx" + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_probe))) || PyTuple_CheckExact(((PyObject *)__pyx_v_probe))) { + +# line 1135 "core/core2.pyx" + __pyx_t_4 = ((PyObject *)__pyx_v_probe); __Pyx_INCREF(__pyx_t_4); __pyx_t_11 = 0; + +# line 1135 "core/core2.pyx" + __pyx_t_12 = NULL; + +# line 1135 "core/core2.pyx" + } else { + +# line 1135 "core/core2.pyx" + __pyx_t_11 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_probe)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1135, __pyx_L1_error) + +# line 1135 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1135 "core/core2.pyx" + __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1135, __pyx_L1_error) + +# line 1135 "core/core2.pyx" + } + +# line 1135 "core/core2.pyx" + for (;;) { + +# line 1135 "core/core2.pyx" + if (likely(!__pyx_t_12)) { + +# line 1135 "core/core2.pyx" + if (likely(PyList_CheckExact(__pyx_t_4))) { + +# line 1135 "core/core2.pyx" + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_4)) break; + +# line 1135 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 1135 "core/core2.pyx" + __pyx_t_13 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_13); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1135, __pyx_L1_error) + +# line 1135 "core/core2.pyx" + #else + +# line 1135 "core/core2.pyx" + __pyx_t_13 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1135, __pyx_L1_error) + +# line 1135 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_13); + +# line 1135 "core/core2.pyx" + #endif + +# line 1135 "core/core2.pyx" + } else { + +# line 1135 "core/core2.pyx" + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + +# line 1135 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 1135 "core/core2.pyx" + __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_13); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1135, __pyx_L1_error) + +# line 1135 "core/core2.pyx" + #else + +# line 1135 "core/core2.pyx" + __pyx_t_13 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1135, __pyx_L1_error) + +# line 1135 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_13); + +# line 1135 "core/core2.pyx" + #endif + +# line 1135 "core/core2.pyx" + } + +# line 1135 "core/core2.pyx" + } else { + +# line 1135 "core/core2.pyx" + __pyx_t_13 = __pyx_t_12(__pyx_t_4); + +# line 1135 "core/core2.pyx" + if (unlikely(!__pyx_t_13)) { + +# line 1135 "core/core2.pyx" + PyObject* exc_type = PyErr_Occurred(); + +# line 1135 "core/core2.pyx" + if (exc_type) { + +# line 1135 "core/core2.pyx" + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + +# line 1135 "core/core2.pyx" + else __PYX_ERR(0, 1135, __pyx_L1_error) + +# line 1135 "core/core2.pyx" + } + +# line 1135 "core/core2.pyx" + break; + +# line 1135 "core/core2.pyx" + } + +# line 1135 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_13); + +# line 1135 "core/core2.pyx" + } + +# line 1135 "core/core2.pyx" + __Pyx_XDECREF_SET(__pyx_v_new_idx, __pyx_t_13); + +# line 1135 "core/core2.pyx" + __pyx_t_13 = 0; + + /* "core/core2.pyx":1136 + * probe = links[vert_idx] + * for new_idx in probe: + * if new_idx not in seen: # <<<<<<<<<<<<<< + * seen.add(new_idx) + * new_front.append(new_idx) + */ + +# line 1136 "core/core2.pyx" + __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_new_idx, __pyx_v_seen, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1136, __pyx_L1_error) + +# line 1136 "core/core2.pyx" + __pyx_t_3 = (__pyx_t_2 != 0); + +# line 1136 "core/core2.pyx" + if (__pyx_t_3) { + + /* "core/core2.pyx":1137 + * for new_idx in probe: + * if new_idx not in seen: + * seen.add(new_idx) # <<<<<<<<<<<<<< + * new_front.append(new_idx) + * rings.append(new_front) + */ + +# line 1137 "core/core2.pyx" + __pyx_t_14 = PySet_Add(__pyx_v_seen, __pyx_v_new_idx); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1137, __pyx_L1_error) + + /* "core/core2.pyx":1138 + * if new_idx not in seen: + * seen.add(new_idx) + * new_front.append(new_idx) # <<<<<<<<<<<<<< + * rings.append(new_front) + * + */ + +# line 1138 "core/core2.pyx" + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_new_front, __pyx_v_new_idx); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1138, __pyx_L1_error) + + /* "core/core2.pyx":1136 + * probe = links[vert_idx] + * for new_idx in probe: + * if new_idx not in seen: # <<<<<<<<<<<<<< + * seen.add(new_idx) + * new_front.append(new_idx) + */ + +# line 1136 "core/core2.pyx" + } + + /* "core/core2.pyx":1135 + * for vert_idx in rings[-1]: + * probe = links[vert_idx] + * for new_idx in probe: # <<<<<<<<<<<<<< + * if new_idx not in seen: + * seen.add(new_idx) + */ + +# line 1135 "core/core2.pyx" + } + +# line 1135 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "core/core2.pyx":1133 + * for i in range(n_rings - 1): + * new_front = [] + * for vert_idx in rings[-1]: # <<<<<<<<<<<<<< + * probe = links[vert_idx] + * for new_idx in probe: + */ + +# line 1133 "core/core2.pyx" + } + +# line 1133 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "core/core2.pyx":1139 + * seen.add(new_idx) + * new_front.append(new_idx) + * rings.append(new_front) # <<<<<<<<<<<<<< + * + * self.n_rings = n_rings + */ + +# line 1139 "core/core2.pyx" + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_rings, __pyx_v_new_front); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1139, __pyx_L1_error) + +# line 1139 "core/core2.pyx" + } + + /* "core/core2.pyx":1141 + * rings.append(new_front) + * + * self.n_rings = n_rings # <<<<<<<<<<<<<< + * self.rings = maelloc(sizeof(int**) * self.n_rings, __LINE__) + * + */ + +# line 1141 "core/core2.pyx" + __pyx_v_self->n_rings = __pyx_v_n_rings; + + /* "core/core2.pyx":1142 + * + * self.n_rings = n_rings + * self.rings = maelloc(sizeof(int**) * self.n_rings, __LINE__) # <<<<<<<<<<<<<< + * + * for i in range(self.n_rings): + */ + +# line 1142 "core/core2.pyx" + __pyx_t_15 = __pyx_f_14softwrap_core2_maelloc(((sizeof(int **)) * __pyx_v_self->n_rings), __LINE__); if (unlikely(__pyx_t_15 == ((void *)NULL))) __PYX_ERR(0, 1142, __pyx_L1_error) + +# line 1142 "core/core2.pyx" + __pyx_v_self->rings = ((int **)__pyx_t_15); + + /* "core/core2.pyx":1144 + * self.rings = maelloc(sizeof(int**) * self.n_rings, __LINE__) + * + * for i in range(self.n_rings): # <<<<<<<<<<<<<< + * self.rings[i] = NULL + * + */ + +# line 1144 "core/core2.pyx" + __pyx_t_7 = __pyx_v_self->n_rings; + +# line 1144 "core/core2.pyx" + __pyx_t_10 = __pyx_t_7; + +# line 1144 "core/core2.pyx" + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_10; __pyx_t_16+=1) { + +# line 1144 "core/core2.pyx" + __pyx_v_i = __pyx_t_16; + + /* "core/core2.pyx":1145 + * + * for i in range(self.n_rings): + * self.rings[i] = NULL # <<<<<<<<<<<<<< + * + * cdef list front + */ + +# line 1145 "core/core2.pyx" + (__pyx_v_self->rings[__pyx_v_i]) = NULL; + +# line 1145 "core/core2.pyx" + } + + /* "core/core2.pyx":1150 + * cdef int j + * + * for i, front in enumerate(rings): # <<<<<<<<<<<<<< + * self.rings[i] = maelloc(sizeof(int*) * (len(front) + 1), __LINE__) + * self.rings[i][0] = len(front) + */ + +# line 1150 "core/core2.pyx" + __pyx_t_7 = 0; + +# line 1150 "core/core2.pyx" + __pyx_t_1 = __pyx_v_rings; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + +# line 1150 "core/core2.pyx" + for (;;) { + +# line 1150 "core/core2.pyx" + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + +# line 1150 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 1150 "core/core2.pyx" + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1150, __pyx_L1_error) + +# line 1150 "core/core2.pyx" + #else + +# line 1150 "core/core2.pyx" + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1150, __pyx_L1_error) + +# line 1150 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1150 "core/core2.pyx" + #endif + +# line 1150 "core/core2.pyx" + if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 1150, __pyx_L1_error) + +# line 1150 "core/core2.pyx" + __Pyx_XDECREF_SET(__pyx_v_front, ((PyObject*)__pyx_t_4)); + +# line 1150 "core/core2.pyx" + __pyx_t_4 = 0; + +# line 1150 "core/core2.pyx" + __pyx_v_i = __pyx_t_7; + +# line 1150 "core/core2.pyx" + __pyx_t_7 = (__pyx_t_7 + 1); + + /* "core/core2.pyx":1151 + * + * for i, front in enumerate(rings): + * self.rings[i] = maelloc(sizeof(int*) * (len(front) + 1), __LINE__) # <<<<<<<<<<<<<< + * self.rings[i][0] = len(front) + * + */ + +# line 1151 "core/core2.pyx" + if (unlikely(__pyx_v_front == Py_None)) { + +# line 1151 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1151 "core/core2.pyx" + __PYX_ERR(0, 1151, __pyx_L1_error) + +# line 1151 "core/core2.pyx" + } + +# line 1151 "core/core2.pyx" + __pyx_t_11 = PyList_GET_SIZE(__pyx_v_front); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1151, __pyx_L1_error) + +# line 1151 "core/core2.pyx" + __pyx_t_15 = __pyx_f_14softwrap_core2_maelloc(((sizeof(int *)) * (__pyx_t_11 + 1)), __LINE__); if (unlikely(__pyx_t_15 == ((void *)NULL))) __PYX_ERR(0, 1151, __pyx_L1_error) + +# line 1151 "core/core2.pyx" + (__pyx_v_self->rings[__pyx_v_i]) = ((int *)__pyx_t_15); + + /* "core/core2.pyx":1152 + * for i, front in enumerate(rings): + * self.rings[i] = maelloc(sizeof(int*) * (len(front) + 1), __LINE__) + * self.rings[i][0] = len(front) # <<<<<<<<<<<<<< + * + * for j in range(self.rings[i][0]): + */ + +# line 1152 "core/core2.pyx" + if (unlikely(__pyx_v_front == Py_None)) { + +# line 1152 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1152 "core/core2.pyx" + __PYX_ERR(0, 1152, __pyx_L1_error) + +# line 1152 "core/core2.pyx" + } + +# line 1152 "core/core2.pyx" + __pyx_t_11 = PyList_GET_SIZE(__pyx_v_front); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1152, __pyx_L1_error) + +# line 1152 "core/core2.pyx" + ((__pyx_v_self->rings[__pyx_v_i])[0]) = __pyx_t_11; + + /* "core/core2.pyx":1154 + * self.rings[i][0] = len(front) + * + * for j in range(self.rings[i][0]): # <<<<<<<<<<<<<< + * self.rings[i][j + 1] = front[j] + * + */ + +# line 1154 "core/core2.pyx" + __pyx_t_10 = ((__pyx_v_self->rings[__pyx_v_i])[0]); + +# line 1154 "core/core2.pyx" + __pyx_t_16 = __pyx_t_10; + +# line 1154 "core/core2.pyx" + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + +# line 1154 "core/core2.pyx" + __pyx_v_j = __pyx_t_17; + + /* "core/core2.pyx":1155 + * + * for j in range(self.rings[i][0]): + * self.rings[i][j + 1] = front[j] # <<<<<<<<<<<<<< + * + * def __getitem__(self, int index): + */ + +# line 1155 "core/core2.pyx" + if (unlikely(__pyx_v_front == Py_None)) { + +# line 1155 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1155 "core/core2.pyx" + __PYX_ERR(0, 1155, __pyx_L1_error) + +# line 1155 "core/core2.pyx" + } + +# line 1155 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_front, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1155, __pyx_L1_error) + +# line 1155 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1155 "core/core2.pyx" + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1155, __pyx_L1_error) + +# line 1155 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1155 "core/core2.pyx" + ((__pyx_v_self->rings[__pyx_v_i])[(__pyx_v_j + 1)]) = __pyx_t_18; + +# line 1155 "core/core2.pyx" + } + + /* "core/core2.pyx":1150 + * cdef int j + * + * for i, front in enumerate(rings): # <<<<<<<<<<<<<< + * self.rings[i] = maelloc(sizeof(int*) * (len(front) + 1), __LINE__) + * self.rings[i][0] = len(front) + */ + +# line 1150 "core/core2.pyx" + } + +# line 1150 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "core/core2.pyx":1115 + * + * + * def __cinit__(self, SpringLinks links, int start_index, int n_rings): # <<<<<<<<<<<<<< + * n_rings = nmax(n_rings, 1) + * self.engine = links.engine + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rings); + __Pyx_XDECREF(__pyx_v_seen); + __Pyx_XDECREF(__pyx_v_new_front); + __Pyx_XDECREF((PyObject *)__pyx_v_probe); + __Pyx_XDECREF(__pyx_v_new_idx); + __Pyx_XDECREF(__pyx_v_front); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1157 + * self.rings[i][j + 1] = front[j] + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if index < 0 or index >= self.n_rings: + * raise IndexError + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { + int __pyx_v_index; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + assert(__pyx_arg_index); { + __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1157, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin_2__getitem__(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self), ((int)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_14softwrap_core2_15SpringEnginePin_11__getitem___2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "core/core2.pyx":1161 + * raise IndexError + * + * def iter_ring(): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.rings[index][0]): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_11__getitem___1iter_ring(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_14softwrap_core2_15SpringEnginePin_11__getitem___1iter_ring = {"iter_ring", (PyCFunction)__pyx_pw_14softwrap_core2_15SpringEnginePin_11__getitem___1iter_ring, METH_NOARGS, 0}; +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_11__getitem___1iter_ring(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("iter_ring (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin_11__getitem___iter_ring(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_11__getitem___iter_ring(PyObject *__pyx_self) { + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("iter_ring", 0); + __pyx_cur_scope = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *)__pyx_tp_new_14softwrap_core2___pyx_scope_struct_2_iter_ring(__pyx_ptype_14softwrap_core2___pyx_scope_struct_2_iter_ring, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 1161, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *) __Pyx_CyFunction_GetClosure(__pyx_self); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_14softwrap_core2_15SpringEnginePin_11__getitem___2generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter_ring, __pyx_n_s_getitem___locals_iter_ring, __pyx_n_s_softwrap_core2); if (unlikely(!gen)) __PYX_ERR(0, 1161, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.__getitem__.iter_ring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_14softwrap_core2_15SpringEnginePin_11__getitem___2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *__pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("iter_ring", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1161, __pyx_L1_error) + + /* "core/core2.pyx":1163 + * def iter_ring(): + * cdef int i + * for i in range(self.rings[index][0]): # <<<<<<<<<<<<<< + * yield self.rings[index][i + 1] + * + */ + +# line 1163 "core/core2.pyx" + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1163, __pyx_L1_error) } + +# line 1163 "core/core2.pyx" + __pyx_t_1 = ((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->rings[__pyx_cur_scope->__pyx_outer_scope->__pyx_v_index])[0]); + +# line 1163 "core/core2.pyx" + __pyx_t_2 = __pyx_t_1; + +# line 1163 "core/core2.pyx" + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + +# line 1163 "core/core2.pyx" + __pyx_cur_scope->__pyx_v_i = __pyx_t_3; + + /* "core/core2.pyx":1164 + * cdef int i + * for i in range(self.rings[index][0]): + * yield self.rings[index][i + 1] # <<<<<<<<<<<<<< + * + * return iter_ring() + */ + +# line 1164 "core/core2.pyx" + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1164, __pyx_L1_error) } + +# line 1164 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyInt_From_int(((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->rings[__pyx_cur_scope->__pyx_outer_scope->__pyx_v_index])[(__pyx_cur_scope->__pyx_v_i + 1)])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1164, __pyx_L1_error) + +# line 1164 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1164 "core/core2.pyx" + __pyx_r = __pyx_t_4; + +# line 1164 "core/core2.pyx" + __pyx_t_4 = 0; + +# line 1164 "core/core2.pyx" + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + +# line 1164 "core/core2.pyx" + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + +# line 1164 "core/core2.pyx" + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + +# line 1164 "core/core2.pyx" + __Pyx_XGIVEREF(__pyx_r); + +# line 1164 "core/core2.pyx" + __Pyx_RefNannyFinishContext(); + +# line 1164 "core/core2.pyx" + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1164, __pyx_L1_error) + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "core/core2.pyx":1161 + * raise IndexError + * + * def iter_ring(): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.rings[index][0]): + */ + + /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("iter_ring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1157 + * self.rings[i][j + 1] = front[j] + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if index < 0 or index >= self.n_rings: + * raise IndexError + */ + + +# line 1157 "core/core2.pyx" +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_2__getitem__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self, int __pyx_v_index) { + +# line 1157 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *__pyx_cur_scope; + +# line 1157 "core/core2.pyx" + PyObject *__pyx_v_iter_ring = 0; + +# line 1157 "core/core2.pyx" + PyObject *__pyx_gb_14softwrap_core2_15SpringEnginePin_11__getitem___2generator2 = 0; + +# line 1157 "core/core2.pyx" + PyObject *__pyx_r = NULL; + +# line 1157 "core/core2.pyx" + __Pyx_RefNannyDeclarations + +# line 1157 "core/core2.pyx" + int __pyx_t_1; + +# line 1157 "core/core2.pyx" + int __pyx_t_2; + +# line 1157 "core/core2.pyx" + PyObject *__pyx_t_3 = NULL; + +# line 1157 "core/core2.pyx" + int __pyx_lineno = 0; + +# line 1157 "core/core2.pyx" + const char *__pyx_filename = NULL; + +# line 1157 "core/core2.pyx" + int __pyx_clineno = 0; + +# line 1157 "core/core2.pyx" + __Pyx_RefNannySetupContext("__getitem__", 0); + +# line 1157 "core/core2.pyx" + __pyx_cur_scope = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *)__pyx_tp_new_14softwrap_core2___pyx_scope_struct_1___getitem__(__pyx_ptype_14softwrap_core2___pyx_scope_struct_1___getitem__, __pyx_empty_tuple, NULL); + +# line 1157 "core/core2.pyx" + if (unlikely(!__pyx_cur_scope)) { + +# line 1157 "core/core2.pyx" + __pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *)Py_None); + +# line 1157 "core/core2.pyx" + __Pyx_INCREF(Py_None); + +# line 1157 "core/core2.pyx" + __PYX_ERR(0, 1157, __pyx_L1_error) + +# line 1157 "core/core2.pyx" + } else { + +# line 1157 "core/core2.pyx" + __Pyx_GOTREF(__pyx_cur_scope); + +# line 1157 "core/core2.pyx" + } + +# line 1157 "core/core2.pyx" + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + +# line 1157 "core/core2.pyx" + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + +# line 1157 "core/core2.pyx" + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + +# line 1157 "core/core2.pyx" + __pyx_cur_scope->__pyx_v_index = __pyx_v_index; + + /* "core/core2.pyx":1158 + * + * def __getitem__(self, int index): + * if index < 0 or index >= self.n_rings: # <<<<<<<<<<<<<< + * raise IndexError + * + */ + +# line 1158 "core/core2.pyx" + __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_index < 0) != 0); + +# line 1158 "core/core2.pyx" + if (!__pyx_t_2) { + +# line 1158 "core/core2.pyx" + } else { + +# line 1158 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 1158 "core/core2.pyx" + goto __pyx_L4_bool_binop_done; + +# line 1158 "core/core2.pyx" + } + +# line 1158 "core/core2.pyx" + __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_index >= __pyx_cur_scope->__pyx_v_self->n_rings) != 0); + +# line 1158 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 1158 "core/core2.pyx" + __pyx_L4_bool_binop_done:; + +# line 1158 "core/core2.pyx" + if (unlikely(__pyx_t_1)) { + + /* "core/core2.pyx":1159 + * def __getitem__(self, int index): + * if index < 0 or index >= self.n_rings: + * raise IndexError # <<<<<<<<<<<<<< + * + * def iter_ring(): + */ + +# line 1159 "core/core2.pyx" + __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); + +# line 1159 "core/core2.pyx" + __PYX_ERR(0, 1159, __pyx_L1_error) + + /* "core/core2.pyx":1158 + * + * def __getitem__(self, int index): + * if index < 0 or index >= self.n_rings: # <<<<<<<<<<<<<< + * raise IndexError + * + */ + +# line 1158 "core/core2.pyx" + } + + /* "core/core2.pyx":1161 + * raise IndexError + * + * def iter_ring(): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.rings[index][0]): + */ + +# line 1161 "core/core2.pyx" + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_14softwrap_core2_15SpringEnginePin_11__getitem___1iter_ring, 0, __pyx_n_s_getitem___locals_iter_ring, ((PyObject*)__pyx_cur_scope), __pyx_n_s_softwrap_core2, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1161, __pyx_L1_error) + +# line 1161 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 1161 "core/core2.pyx" + __pyx_v_iter_ring = __pyx_t_3; + +# line 1161 "core/core2.pyx" + __pyx_t_3 = 0; + + /* "core/core2.pyx":1166 + * yield self.rings[index][i + 1] + * + * return iter_ring() # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + +# line 1166 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 1166 "core/core2.pyx" + __pyx_t_3 = __pyx_pf_14softwrap_core2_15SpringEnginePin_11__getitem___iter_ring(__pyx_v_iter_ring); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1166, __pyx_L1_error) + +# line 1166 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 1166 "core/core2.pyx" + __pyx_r = __pyx_t_3; + +# line 1166 "core/core2.pyx" + __pyx_t_3 = 0; + +# line 1166 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1157 + * self.rings[i][j + 1] = front[j] + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if index < 0 or index >= self.n_rings: + * raise IndexError + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_iter_ring); + __Pyx_XDECREF(__pyx_gb_14softwrap_core2_15SpringEnginePin_11__getitem___2generator2); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_14softwrap_core2_15SpringEnginePin_6generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "core/core2.pyx":1168 + * return iter_ring() + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.n_rings): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin_4__iter__(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_4__iter__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self) { + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + __pyx_cur_scope = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *)__pyx_tp_new_14softwrap_core2___pyx_scope_struct_3___iter__(__pyx_ptype_14softwrap_core2___pyx_scope_struct_3___iter__, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 1168, __pyx_L1_error) + } else { + __Pyx_GOTREF(__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_14softwrap_core2_15SpringEnginePin_6generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SpringEnginePin___iter, __pyx_n_s_softwrap_core2); if (unlikely(!gen)) __PYX_ERR(0, 1168, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_14softwrap_core2_15SpringEnginePin_6generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *__pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1168, __pyx_L1_error) + + /* "core/core2.pyx":1170 + * def __iter__(self): + * cdef int i + * for i in range(self.n_rings): # <<<<<<<<<<<<<< + * yield self[i] + * + */ + +# line 1170 "core/core2.pyx" + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->n_rings; + +# line 1170 "core/core2.pyx" + __pyx_t_2 = __pyx_t_1; + +# line 1170 "core/core2.pyx" + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + +# line 1170 "core/core2.pyx" + __pyx_cur_scope->__pyx_v_i = __pyx_t_3; + + /* "core/core2.pyx":1171 + * cdef int i + * for i in range(self.n_rings): + * yield self[i] # <<<<<<<<<<<<<< + * + * def move(self, float x, float y, float z, float scale): + */ + +# line 1171 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1171, __pyx_L1_error) + +# line 1171 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1171 "core/core2.pyx" + __pyx_r = __pyx_t_4; + +# line 1171 "core/core2.pyx" + __pyx_t_4 = 0; + +# line 1171 "core/core2.pyx" + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + +# line 1171 "core/core2.pyx" + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + +# line 1171 "core/core2.pyx" + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + +# line 1171 "core/core2.pyx" + __Pyx_XGIVEREF(__pyx_r); + +# line 1171 "core/core2.pyx" + __Pyx_RefNannyFinishContext(); + +# line 1171 "core/core2.pyx" + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1171, __pyx_L1_error) + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "core/core2.pyx":1168 + * return iter_ring() + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.n_rings): + */ + + /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1173 + * yield self[i] + * + * def move(self, float x, float y, float z, float scale): # <<<<<<<<<<<<<< + * cdef vec3 vec = vec3(x, y, z) + * cdef vec3 ring_vec + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_8move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_8move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_x; + float __pyx_v_y; + float __pyx_v_z; + float __pyx_v_scale; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("move (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,&__pyx_n_s_scale,0}; + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("move", 1, 4, 4, 1); __PYX_ERR(0, 1173, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("move", 1, 4, 4, 2); __PYX_ERR(0, 1173, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scale)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("move", 1, 4, 4, 3); __PYX_ERR(0, 1173, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "move") < 0)) __PYX_ERR(0, 1173, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_x = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L3_error) + __pyx_v_y = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_y == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L3_error) + __pyx_v_z = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_z == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L3_error) + __pyx_v_scale = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_scale == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("move", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1173, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.move", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin_7move(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_scale); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_7move(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_scale) { + vec3 __pyx_v_vec; + vec3 __pyx_v_ring_vec; + int __pyx_v_i; + int __pyx_v_j; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("move", 0); + + /* "core/core2.pyx":1174 + * + * def move(self, float x, float y, float z, float scale): + * cdef vec3 vec = vec3(x, y, z) # <<<<<<<<<<<<<< + * cdef vec3 ring_vec + * + */ + +# line 1174 "core/core2.pyx" + __pyx_v_vec = vec3(__pyx_v_x, __pyx_v_y, __pyx_v_z); + + /* "core/core2.pyx":1178 + * + * cdef int i, j + * for i in range(self.n_rings): # <<<<<<<<<<<<<< + * ring_vec = vec * nclamp((scale - i - 1) / (scale - 1), 0, 1) + * for j in range(self.rings[i][0]): + */ + +# line 1178 "core/core2.pyx" + __pyx_t_1 = __pyx_v_self->n_rings; + +# line 1178 "core/core2.pyx" + __pyx_t_2 = __pyx_t_1; + +# line 1178 "core/core2.pyx" + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + +# line 1178 "core/core2.pyx" + __pyx_v_i = __pyx_t_3; + + /* "core/core2.pyx":1179 + * cdef int i, j + * for i in range(self.n_rings): + * ring_vec = vec * nclamp((scale - i - 1) / (scale - 1), 0, 1) # <<<<<<<<<<<<<< + * for j in range(self.rings[i][0]): + * self.engine.m.verts[self.rings[i][j + 1]] += ring_vec + */ + +# line 1179 "core/core2.pyx" + __pyx_v_ring_vec = (__pyx_v_vec * nclamp((((__pyx_v_scale - __pyx_v_i) - ((float)1)) / (__pyx_v_scale - ((float)1))), ((float)0), ((float)1))); + + /* "core/core2.pyx":1180 + * for i in range(self.n_rings): + * ring_vec = vec * nclamp((scale - i - 1) / (scale - 1), 0, 1) + * for j in range(self.rings[i][0]): # <<<<<<<<<<<<<< + * self.engine.m.verts[self.rings[i][j + 1]] += ring_vec + * # self.engine.prev_verts[self.rings[i][j + 1]] += ring_vec + */ + +# line 1180 "core/core2.pyx" + __pyx_t_4 = ((__pyx_v_self->rings[__pyx_v_i])[0]); + +# line 1180 "core/core2.pyx" + __pyx_t_5 = __pyx_t_4; + +# line 1180 "core/core2.pyx" + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + +# line 1180 "core/core2.pyx" + __pyx_v_j = __pyx_t_6; + + /* "core/core2.pyx":1181 + * ring_vec = vec * nclamp((scale - i - 1) / (scale - 1), 0, 1) + * for j in range(self.rings[i][0]): + * self.engine.m.verts[self.rings[i][j + 1]] += ring_vec # <<<<<<<<<<<<<< + * # self.engine.prev_verts[self.rings[i][j + 1]] += ring_vec + * + */ + +# line 1181 "core/core2.pyx" + (__pyx_v_self->engine->m->verts[((__pyx_v_self->rings[__pyx_v_i])[(__pyx_v_j + 1)])]) += __pyx_v_ring_vec; + +# line 1181 "core/core2.pyx" + } + +# line 1181 "core/core2.pyx" + } + + /* "core/core2.pyx":1173 + * yield self[i] + * + * def move(self, float x, float y, float z, float scale): # <<<<<<<<<<<<<< + * cdef vec3 vec = vec3(x, y, z) + * cdef vec3 ring_vec + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1185 + * + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.n_rings): + */ + +/* Python wrapper */ +static void __pyx_pw_14softwrap_core2_15SpringEnginePin_10__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_14softwrap_core2_15SpringEnginePin_10__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_14softwrap_core2_15SpringEnginePin_9__dealloc__(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_14softwrap_core2_15SpringEnginePin_9__dealloc__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "core/core2.pyx":1187 + * def __dealloc__(self): + * cdef int i + * for i in range(self.n_rings): # <<<<<<<<<<<<<< + * fraeee(self.rings[i]) + * fraeee(self.rings) + */ + +# line 1187 "core/core2.pyx" + __pyx_t_1 = __pyx_v_self->n_rings; + +# line 1187 "core/core2.pyx" + __pyx_t_2 = __pyx_t_1; + +# line 1187 "core/core2.pyx" + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + +# line 1187 "core/core2.pyx" + __pyx_v_i = __pyx_t_3; + + /* "core/core2.pyx":1188 + * cdef int i + * for i in range(self.n_rings): + * fraeee(self.rings[i]) # <<<<<<<<<<<<<< + * fraeee(self.rings) + * + */ + +# line 1188 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee((__pyx_v_self->rings[__pyx_v_i])); + +# line 1188 "core/core2.pyx" + } + + /* "core/core2.pyx":1189 + * for i in range(self.n_rings): + * fraeee(self.rings[i]) + * fraeee(self.rings) # <<<<<<<<<<<<<< + * + * + */ + +# line 1189 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->rings); + + /* "core/core2.pyx":1185 + * + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.n_rings): + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "core/core2.pyx":1109 + * @cython.final + * cdef class SpringEnginePin: + * cdef readonly SpringEngine engine # <<<<<<<<<<<<<< + * cdef readonly int n_rings + * cdef readonly int start_index + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_6engine_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_6engine_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin_6engine___get__(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_6engine___get__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->engine)); + __pyx_r = ((PyObject *)__pyx_v_self->engine); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1110 + * cdef class SpringEnginePin: + * cdef readonly SpringEngine engine + * cdef readonly int n_rings # <<<<<<<<<<<<<< + * cdef readonly int start_index + * cdef int** rings + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_7n_rings_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_7n_rings_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin_7n_rings___get__(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_7n_rings___get__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->n_rings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.n_rings.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1111 + * cdef readonly SpringEngine engine + * cdef readonly int n_rings + * cdef readonly int start_index # <<<<<<<<<<<<<< + * cdef int** rings + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_11start_index_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_11start_index_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin_11start_index___get__(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_11start_index___get__(struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->start_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.start_index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_12__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_12__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin_11__reduce_cython__(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_11__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_14__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_15SpringEnginePin_14__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_15SpringEnginePin_13__setstate_cython__(((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_15SpringEnginePin_13__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEnginePin *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEnginePin.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1197 + * cdef bint invert + * + * def __cinit__(self, SpringEngineMask mask, float factor, bint invert): # <<<<<<<<<<<<<< + * self.mask = mask + * self.factor = factor + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_19_MaskContextManager_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_19_MaskContextManager_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_mask = 0; + float __pyx_v_factor; + int __pyx_v_invert; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mask,&__pyx_n_s_factor,&__pyx_n_s_invert,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 1197, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_invert)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 1197, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1197, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_mask = ((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)values[0]); + __pyx_v_factor = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1197, __pyx_L3_error) + __pyx_v_invert = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_invert == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1197, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1197, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2._MaskContextManager.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_14softwrap_core2_SpringEngineMask, 1, "mask", 0))) __PYX_ERR(0, 1197, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_19_MaskContextManager___cinit__(((struct __pyx_obj_14softwrap_core2__MaskContextManager *)__pyx_v_self), __pyx_v_mask, __pyx_v_factor, __pyx_v_invert); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_19_MaskContextManager___cinit__(struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_mask, float __pyx_v_factor, int __pyx_v_invert) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "core/core2.pyx":1198 + * + * def __cinit__(self, SpringEngineMask mask, float factor, bint invert): + * self.mask = mask # <<<<<<<<<<<<<< + * self.factor = factor + * self.invert = invert + */ + +# line 1198 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_mask)); + +# line 1198 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_mask)); + +# line 1198 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->mask); + +# line 1198 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->mask)); + +# line 1198 "core/core2.pyx" + __pyx_v_self->mask = __pyx_v_mask; + + /* "core/core2.pyx":1199 + * def __cinit__(self, SpringEngineMask mask, float factor, bint invert): + * self.mask = mask + * self.factor = factor # <<<<<<<<<<<<<< + * self.invert = invert + * + */ + +# line 1199 "core/core2.pyx" + __pyx_v_self->factor = __pyx_v_factor; + + /* "core/core2.pyx":1200 + * self.mask = mask + * self.factor = factor + * self.invert = invert # <<<<<<<<<<<<<< + * + * def __enter__(self): + */ + +# line 1200 "core/core2.pyx" + __pyx_v_self->invert = __pyx_v_invert; + + /* "core/core2.pyx":1197 + * cdef bint invert + * + * def __cinit__(self, SpringEngineMask mask, float factor, bint invert): # <<<<<<<<<<<<<< + * self.mask = mask + * self.factor = factor + */ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1202 + * self.invert = invert + * + * def __enter__(self): # <<<<<<<<<<<<<< + * self.mask.load() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_19_MaskContextManager_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_19_MaskContextManager_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_19_MaskContextManager_2__enter__(((struct __pyx_obj_14softwrap_core2__MaskContextManager *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_19_MaskContextManager_2__enter__(struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__", 0); + + /* "core/core2.pyx":1203 + * + * def __enter__(self): + * self.mask.load() # <<<<<<<<<<<<<< + * + * def __exit__(self, type, value, traceback): + */ + +# line 1203 "core/core2.pyx" + ((struct __pyx_vtabstruct_14softwrap_core2_SpringEngineMask *)__pyx_v_self->mask->__pyx_vtab)->load(__pyx_v_self->mask, 0); + + /* "core/core2.pyx":1202 + * self.invert = invert + * + * def __enter__(self): # <<<<<<<<<<<<<< + * self.mask.load() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1205 + * self.mask.load() + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.mask.masked_store(self.factor, self.invert) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_19_MaskContextManager_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_19_MaskContextManager_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_type = 0; + CYTHON_UNUSED PyObject *__pyx_v_value = 0; + CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 1205, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 1205, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 1205, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_type = values[0]; + __pyx_v_value = values[1]; + __pyx_v_traceback = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1205, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2._MaskContextManager.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_19_MaskContextManager_4__exit__(((struct __pyx_obj_14softwrap_core2__MaskContextManager *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_19_MaskContextManager_4__exit__(struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_14softwrap_core2_16SpringEngineMask_masked_store __pyx_t_1; + __Pyx_RefNannySetupContext("__exit__", 0); + + /* "core/core2.pyx":1206 + * + * def __exit__(self, type, value, traceback): + * self.mask.masked_store(self.factor, self.invert) # <<<<<<<<<<<<<< + * + * + */ + +# line 1206 "core/core2.pyx" + __pyx_t_1.__pyx_n = 2; + +# line 1206 "core/core2.pyx" + __pyx_t_1.factor = __pyx_v_self->factor; + +# line 1206 "core/core2.pyx" + __pyx_t_1.invert = __pyx_v_self->invert; + +# line 1206 "core/core2.pyx" + ((struct __pyx_vtabstruct_14softwrap_core2_SpringEngineMask *)__pyx_v_self->mask->__pyx_vtab)->masked_store(__pyx_v_self->mask, 0, &__pyx_t_1); + + /* "core/core2.pyx":1205 + * self.mask.load() + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self.mask.masked_store(self.factor, self.invert) + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_19_MaskContextManager_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_19_MaskContextManager_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_19_MaskContextManager_6__reduce_cython__(((struct __pyx_obj_14softwrap_core2__MaskContextManager *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_19_MaskContextManager_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2._MaskContextManager.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_19_MaskContextManager_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_19_MaskContextManager_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_19_MaskContextManager_8__setstate_cython__(((struct __pyx_obj_14softwrap_core2__MaskContextManager *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_19_MaskContextManager_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2__MaskContextManager *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2._MaskContextManager.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1216 + * cdef SpringEngine engine + * + * def __cinit__(self, SpringEngine engine, list mask): # <<<<<<<<<<<<<< + * self.engine = engine + * + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_16SpringEngineMask_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_16SpringEngineMask_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine = 0; + PyObject *__pyx_v_mask = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_engine,&__pyx_n_s_mask,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_engine)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 1216, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1216, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)values[0]); + __pyx_v_mask = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1216, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_engine), __pyx_ptype_14softwrap_core2_SpringEngine, 1, "engine", 0))) __PYX_ERR(0, 1216, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), (&PyList_Type), 1, "mask", 1))) __PYX_ERR(0, 1216, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask___cinit__(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self), __pyx_v_engine, __pyx_v_mask); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_16SpringEngineMask___cinit__(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine, PyObject *__pyx_v_mask) { + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + void *__pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + float __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "core/core2.pyx":1217 + * + * def __cinit__(self, SpringEngine engine, list mask): + * self.engine = engine # <<<<<<<<<<<<<< + * + * if not mask: + */ + +# line 1217 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_engine)); + +# line 1217 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_engine)); + +# line 1217 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->engine); + +# line 1217 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->engine)); + +# line 1217 "core/core2.pyx" + __pyx_v_self->engine = __pyx_v_engine; + + /* "core/core2.pyx":1219 + * self.engine = engine + * + * if not mask: # <<<<<<<<<<<<<< + * self.mask = NULL + * self.vec_data = NULL + */ + +# line 1219 "core/core2.pyx" + __pyx_t_1 = (__pyx_v_mask != Py_None)&&(PyList_GET_SIZE(__pyx_v_mask) != 0); + +# line 1219 "core/core2.pyx" + __pyx_t_2 = ((!__pyx_t_1) != 0); + +# line 1219 "core/core2.pyx" + if (__pyx_t_2) { + + /* "core/core2.pyx":1220 + * + * if not mask: + * self.mask = NULL # <<<<<<<<<<<<<< + * self.vec_data = NULL + * return + */ + +# line 1220 "core/core2.pyx" + __pyx_v_self->mask = NULL; + + /* "core/core2.pyx":1221 + * if not mask: + * self.mask = NULL + * self.vec_data = NULL # <<<<<<<<<<<<<< + * return + * + */ + +# line 1221 "core/core2.pyx" + __pyx_v_self->vec_data = NULL; + + /* "core/core2.pyx":1222 + * self.mask = NULL + * self.vec_data = NULL + * return # <<<<<<<<<<<<<< + * + * elif not len(mask) == engine.n_verts: + */ + +# line 1222 "core/core2.pyx" + __pyx_r = 0; + +# line 1222 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1219 + * self.engine = engine + * + * if not mask: # <<<<<<<<<<<<<< + * self.mask = NULL + * self.vec_data = NULL + */ + +# line 1219 "core/core2.pyx" + } + + /* "core/core2.pyx":1224 + * return + * + * elif not len(mask) == engine.n_verts: # <<<<<<<<<<<<<< + * raise ValueError('mask must have the same number of elements as engine verts') + * + */ + +# line 1224 "core/core2.pyx" + if (unlikely(__pyx_v_mask == Py_None)) { + +# line 1224 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1224 "core/core2.pyx" + __PYX_ERR(0, 1224, __pyx_L1_error) + +# line 1224 "core/core2.pyx" + } + +# line 1224 "core/core2.pyx" + __pyx_t_3 = PyList_GET_SIZE(__pyx_v_mask); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1224, __pyx_L1_error) + +# line 1224 "core/core2.pyx" + __pyx_t_2 = ((!((__pyx_t_3 == __pyx_v_engine->n_verts) != 0)) != 0); + +# line 1224 "core/core2.pyx" + if (unlikely(__pyx_t_2)) { + + /* "core/core2.pyx":1225 + * + * elif not len(mask) == engine.n_verts: + * raise ValueError('mask must have the same number of elements as engine verts') # <<<<<<<<<<<<<< + * + * self.mask = maelloc(sizeof(float) * self.engine.n_verts, __LINE__) + */ + +# line 1225 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1225, __pyx_L1_error) + +# line 1225 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1225 "core/core2.pyx" + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + +# line 1225 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1225 "core/core2.pyx" + __PYX_ERR(0, 1225, __pyx_L1_error) + + /* "core/core2.pyx":1224 + * return + * + * elif not len(mask) == engine.n_verts: # <<<<<<<<<<<<<< + * raise ValueError('mask must have the same number of elements as engine verts') + * + */ + +# line 1224 "core/core2.pyx" + } + + /* "core/core2.pyx":1227 + * raise ValueError('mask must have the same number of elements as engine verts') + * + * self.mask = maelloc(sizeof(float) * self.engine.n_verts, __LINE__) # <<<<<<<<<<<<<< + * self.vec_data = maelloc(sizeof(vec3) * self.engine.n_verts, __LINE__) + * + */ + +# line 1227 "core/core2.pyx" + __pyx_t_5 = __pyx_f_14softwrap_core2_maelloc(((sizeof(float)) * __pyx_v_self->engine->n_verts), __LINE__); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(0, 1227, __pyx_L1_error) + +# line 1227 "core/core2.pyx" + __pyx_v_self->mask = ((float *)__pyx_t_5); + + /* "core/core2.pyx":1228 + * + * self.mask = maelloc(sizeof(float) * self.engine.n_verts, __LINE__) + * self.vec_data = maelloc(sizeof(vec3) * self.engine.n_verts, __LINE__) # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1228 "core/core2.pyx" + __pyx_t_5 = __pyx_f_14softwrap_core2_maelloc(((sizeof(vec3)) * __pyx_v_self->engine->n_verts), __LINE__); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(0, 1228, __pyx_L1_error) + +# line 1228 "core/core2.pyx" + __pyx_v_self->vec_data = ((vec3 *)__pyx_t_5); + + /* "core/core2.pyx":1231 + * + * cdef int i + * for i in range(self.engine.n_verts): # <<<<<<<<<<<<<< + * self.mask[i] = mask[i] + * + */ + +# line 1231 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->engine->n_verts; + +# line 1231 "core/core2.pyx" + __pyx_t_7 = __pyx_t_6; + +# line 1231 "core/core2.pyx" + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + +# line 1231 "core/core2.pyx" + __pyx_v_i = __pyx_t_8; + + /* "core/core2.pyx":1232 + * cdef int i + * for i in range(self.engine.n_verts): + * self.mask[i] = mask[i] # <<<<<<<<<<<<<< + * + * def __getitem__(self, int index): + */ + +# line 1232 "core/core2.pyx" + if (unlikely(__pyx_v_mask == Py_None)) { + +# line 1232 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1232 "core/core2.pyx" + __PYX_ERR(0, 1232, __pyx_L1_error) + +# line 1232 "core/core2.pyx" + } + +# line 1232 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_mask, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1232, __pyx_L1_error) + +# line 1232 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1232 "core/core2.pyx" + __pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1232, __pyx_L1_error) + +# line 1232 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1232 "core/core2.pyx" + (__pyx_v_self->mask[__pyx_v_i]) = __pyx_t_9; + +# line 1232 "core/core2.pyx" + } + + /* "core/core2.pyx":1216 + * cdef SpringEngine engine + * + * def __cinit__(self, SpringEngine engine, list mask): # <<<<<<<<<<<<<< + * self.engine = engine + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1234 + * self.mask[i] = mask[i] + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return 0.0 + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { + int __pyx_v_index; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + assert(__pyx_arg_index); { + __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1234, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_2__getitem__(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self), ((int)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_2__getitem__(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "core/core2.pyx":1235 + * + * def __getitem__(self, int index): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return 0.0 + * + */ + +# line 1235 "core/core2.pyx" + __pyx_t_1 = ((__pyx_v_self->mask == NULL) != 0); + +# line 1235 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":1236 + * def __getitem__(self, int index): + * if self.mask == NULL: + * return 0.0 # <<<<<<<<<<<<<< + * + * index_check(index, self.engine.n_verts) + */ + +# line 1236 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 1236 "core/core2.pyx" + __Pyx_INCREF(__pyx_float_0_0); + +# line 1236 "core/core2.pyx" + __pyx_r = __pyx_float_0_0; + +# line 1236 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1235 + * + * def __getitem__(self, int index): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return 0.0 + * + */ + +# line 1235 "core/core2.pyx" + } + + /* "core/core2.pyx":1238 + * return 0.0 + * + * index_check(index, self.engine.n_verts) # <<<<<<<<<<<<<< + * return self.mask[index] + * + */ + +# line 1238 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_index_check(__pyx_v_index, __pyx_v_self->engine->n_verts, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1238, __pyx_L1_error) + +# line 1238 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1238 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "core/core2.pyx":1239 + * + * index_check(index, self.engine.n_verts) + * return self.mask[index] # <<<<<<<<<<<<<< + * + * def __setitem__(self, int index, value): + */ + +# line 1239 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 1239 "core/core2.pyx" + __pyx_t_2 = PyFloat_FromDouble((__pyx_v_self->mask[__pyx_v_index])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error) + +# line 1239 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1239 "core/core2.pyx" + __pyx_r = __pyx_t_2; + +# line 1239 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 1239 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1234 + * self.mask[i] = mask[i] + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return 0.0 + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1241 + * return self.mask[index] + * + * def __setitem__(self, int index, value): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_16SpringEngineMask_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_14softwrap_core2_16SpringEngineMask_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_value) { + int __pyx_v_index; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + assert(__pyx_arg_index); { + __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1241, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_4__setitem__(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self), ((int)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_16SpringEngineMask_4__setitem__(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + float __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "core/core2.pyx":1242 + * + * def __setitem__(self, int index, value): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1242 "core/core2.pyx" + __pyx_t_1 = ((__pyx_v_self->mask == NULL) != 0); + +# line 1242 "core/core2.pyx" + if (__pyx_t_1) { + + /* "core/core2.pyx":1243 + * def __setitem__(self, int index, value): + * if self.mask == NULL: + * return # <<<<<<<<<<<<<< + * + * index_check(index, self.engine.n_verts) + */ + +# line 1243 "core/core2.pyx" + __pyx_r = 0; + +# line 1243 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1242 + * + * def __setitem__(self, int index, value): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1242 "core/core2.pyx" + } + + /* "core/core2.pyx":1245 + * return + * + * index_check(index, self.engine.n_verts) # <<<<<<<<<<<<<< + * self.mask[index] = value + * + */ + +# line 1245 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_index_check(__pyx_v_index, __pyx_v_self->engine->n_verts, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1245, __pyx_L1_error) + +# line 1245 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1245 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "core/core2.pyx":1246 + * + * index_check(index, self.engine.n_verts) + * self.mask[index] = value # <<<<<<<<<<<<<< + * + * cpdef set_force(self, float x, float y, float z): + */ + +# line 1246 "core/core2.pyx" + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1246, __pyx_L1_error) + +# line 1246 "core/core2.pyx" + (__pyx_v_self->mask[__pyx_v_index]) = __pyx_t_3; + + /* "core/core2.pyx":1241 + * return self.mask[index] + * + * def __setitem__(self, int index, value): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1248 + * self.mask[index] = value + * + * cpdef set_force(self, float x, float y, float z): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_7set_force(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_14softwrap_core2_16SpringEngineMask_set_force(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, int __pyx_skip_dispatch) { + int __pyx_v_i; + vec3 __pyx_v_d; + vec3 __pyx_v_v; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_force", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_force); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_16SpringEngineMask_7set_force)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_z); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = __pyx_t_1; __pyx_t_7 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__pyx_t_7) { + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1249 + * + * cpdef set_force(self, float x, float y, float z): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1249 "core/core2.pyx" + __pyx_t_10 = ((__pyx_v_self->mask == NULL) != 0); + +# line 1249 "core/core2.pyx" + if (__pyx_t_10) { + + /* "core/core2.pyx":1250 + * cpdef set_force(self, float x, float y, float z): + * if self.mask == NULL: + * return # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1250 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 1250 "core/core2.pyx" + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + +# line 1250 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1249 + * + * cpdef set_force(self, float x, float y, float z): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1249 "core/core2.pyx" + } + + /* "core/core2.pyx":1254 + * cdef int i + * cdef vec3 d, v + * v = vec3(x, y, z) # <<<<<<<<<<<<<< + * with nogil: + * for i in prange(self.engine.n_verts): + */ + +# line 1254 "core/core2.pyx" + __pyx_v_v = vec3(__pyx_v_x, __pyx_v_y, __pyx_v_z); + + /* "core/core2.pyx":1255 + * cdef vec3 d, v + * v = vec3(x, y, z) + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * d = self.engine.m.verts[i] - self.engine.prev_verts[i] + */ + +# line 1255 "core/core2.pyx" + { + +# line 1255 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1255 "core/core2.pyx" + PyThreadState *_save; + +# line 1255 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1255 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1255 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1256 + * v = vec3(x, y, z) + * with nogil: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * d = self.engine.m.verts[i] - self.engine.prev_verts[i] + * d = d.lerp(v, self.mask[i]) + */ + +# line 1256 "core/core2.pyx" + __pyx_t_8 = __pyx_v_self->engine->n_verts; + +# line 1256 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1256 "core/core2.pyx" + { + +# line 1256 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1256 "core/core2.pyx" + #undef likely + +# line 1256 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1256 "core/core2.pyx" + #endif + +# line 1256 "core/core2.pyx" + __pyx_t_12 = (__pyx_t_8 - 0 + 1 - 1/abs(1)) / 1; + +# line 1256 "core/core2.pyx" + if (__pyx_t_12 > 0) + +# line 1256 "core/core2.pyx" + { + +# line 1256 "core/core2.pyx" + #ifdef _OPENMP + +# line 1256 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_d) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_11); + + /* "core/core2.pyx":1257 + * with nogil: + * for i in prange(self.engine.n_verts): + * d = self.engine.m.verts[i] - self.engine.prev_verts[i] # <<<<<<<<<<<<<< + * d = d.lerp(v, self.mask[i]) + * self.engine.m.verts[i] = self.engine.prev_verts[i] + d + */ + +# line 1257 "core/core2.pyx" + __pyx_v_d = ((__pyx_v_self->engine->m->verts[__pyx_v_i]) - (__pyx_v_self->engine->prev_verts[__pyx_v_i])); + + /* "core/core2.pyx":1258 + * for i in prange(self.engine.n_verts): + * d = self.engine.m.verts[i] - self.engine.prev_verts[i] + * d = d.lerp(v, self.mask[i]) # <<<<<<<<<<<<<< + * self.engine.m.verts[i] = self.engine.prev_verts[i] + d + * + */ + +# line 1258 "core/core2.pyx" + __pyx_v_d = __pyx_v_d.lerp(__pyx_v_v, (__pyx_v_self->mask[__pyx_v_i])); + + /* "core/core2.pyx":1259 + * d = self.engine.m.verts[i] - self.engine.prev_verts[i] + * d = d.lerp(v, self.mask[i]) + * self.engine.m.verts[i] = self.engine.prev_verts[i] + d # <<<<<<<<<<<<<< + * + * cpdef void load(self): + */ + +# line 1259 "core/core2.pyx" + (__pyx_v_self->engine->m->verts[__pyx_v_i]) = ((__pyx_v_self->engine->prev_verts[__pyx_v_i]) + __pyx_v_d); + +# line 1259 "core/core2.pyx" + } + +# line 1259 "core/core2.pyx" + } + +# line 1259 "core/core2.pyx" + } + +# line 1259 "core/core2.pyx" + } + +# line 1259 "core/core2.pyx" + } + +# line 1259 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1259 "core/core2.pyx" + #undef likely + +# line 1259 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1259 "core/core2.pyx" + #endif + +# line 1259 "core/core2.pyx" + } + + /* "core/core2.pyx":1255 + * cdef vec3 d, v + * v = vec3(x, y, z) + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * d = self.engine.m.verts[i] - self.engine.prev_verts[i] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":1248 + * self.mask[index] = value + * + * cpdef set_force(self, float x, float y, float z): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.set_force", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_7set_force(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_7set_force(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_x; + float __pyx_v_y; + float __pyx_v_z; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_force (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_force", 1, 3, 3, 1); __PYX_ERR(0, 1248, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_force", 1, 3, 3, 2); __PYX_ERR(0, 1248, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_force") < 0)) __PYX_ERR(0, 1248, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_x = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1248, __pyx_L3_error) + __pyx_v_y = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_y == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1248, __pyx_L3_error) + __pyx_v_z = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_z == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1248, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_force", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1248, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.set_force", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_6set_force(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_6set_force(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_force", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_14softwrap_core2_16SpringEngineMask_set_force(__pyx_v_self, __pyx_v_x, __pyx_v_y, __pyx_v_z, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.set_force", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1261 + * self.engine.m.verts[i] = self.engine.prev_verts[i] + d + * + * cpdef void load(self): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_9load(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_14softwrap_core2_16SpringEngineMask_load(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("load", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_16SpringEngineMask_9load)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1262 + * + * cpdef void load(self): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1262 "core/core2.pyx" + __pyx_t_5 = ((__pyx_v_self->mask == NULL) != 0); + +# line 1262 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1263 + * cpdef void load(self): + * if self.mask == NULL: + * return # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1263 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1262 + * + * cpdef void load(self): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1262 "core/core2.pyx" + } + + /* "core/core2.pyx":1266 + * + * cdef int i + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * self.vec_data[i] = self.engine.m.verts[i] + */ + +# line 1266 "core/core2.pyx" + { + +# line 1266 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1266 "core/core2.pyx" + PyThreadState *_save; + +# line 1266 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1266 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1266 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1267 + * cdef int i + * with nogil: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * self.vec_data[i] = self.engine.m.verts[i] + * + */ + +# line 1267 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->engine->n_verts; + +# line 1267 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1267 "core/core2.pyx" + { + +# line 1267 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1267 "core/core2.pyx" + #undef likely + +# line 1267 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1267 "core/core2.pyx" + #endif + +# line 1267 "core/core2.pyx" + __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; + +# line 1267 "core/core2.pyx" + if (__pyx_t_8 > 0) + +# line 1267 "core/core2.pyx" + { + +# line 1267 "core/core2.pyx" + #ifdef _OPENMP + +# line 1267 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); + + /* "core/core2.pyx":1268 + * with nogil: + * for i in prange(self.engine.n_verts): + * self.vec_data[i] = self.engine.m.verts[i] # <<<<<<<<<<<<<< + * + * cpdef void store(self): + */ + +# line 1268 "core/core2.pyx" + (__pyx_v_self->vec_data[__pyx_v_i]) = (__pyx_v_self->engine->m->verts[__pyx_v_i]); + +# line 1268 "core/core2.pyx" + } + +# line 1268 "core/core2.pyx" + } + +# line 1268 "core/core2.pyx" + } + +# line 1268 "core/core2.pyx" + } + +# line 1268 "core/core2.pyx" + } + +# line 1268 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1268 "core/core2.pyx" + #undef likely + +# line 1268 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1268 "core/core2.pyx" + #endif + +# line 1268 "core/core2.pyx" + } + + /* "core/core2.pyx":1266 + * + * cdef int i + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * self.vec_data[i] = self.engine.m.verts[i] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":1261 + * self.engine.m.verts[i] = self.engine.prev_verts[i] + d + * + * cpdef void load(self): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("softwrap_core2.SpringEngineMask.load", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_9load(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_9load(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("load (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_8load(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_8load(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("load", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_16SpringEngineMask_load(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.load", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1270 + * self.vec_data[i] = self.engine.m.verts[i] + * + * cpdef void store(self): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_11store(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static void __pyx_f_14softwrap_core2_16SpringEngineMask_store(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("store", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_store); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_16SpringEngineMask_11store)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1271 + * + * cpdef void store(self): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1271 "core/core2.pyx" + __pyx_t_5 = ((__pyx_v_self->mask == NULL) != 0); + +# line 1271 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1272 + * cpdef void store(self): + * if self.mask == NULL: + * return # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1272 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1271 + * + * cpdef void store(self): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1271 "core/core2.pyx" + } + + /* "core/core2.pyx":1275 + * + * cdef int i + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * self.engine.m.verts[i] = self.vec_data[i] + */ + +# line 1275 "core/core2.pyx" + { + +# line 1275 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1275 "core/core2.pyx" + PyThreadState *_save; + +# line 1275 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1275 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1275 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1276 + * cdef int i + * with nogil: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * self.engine.m.verts[i] = self.vec_data[i] + * + */ + +# line 1276 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->engine->n_verts; + +# line 1276 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1276 "core/core2.pyx" + { + +# line 1276 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1276 "core/core2.pyx" + #undef likely + +# line 1276 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1276 "core/core2.pyx" + #endif + +# line 1276 "core/core2.pyx" + __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; + +# line 1276 "core/core2.pyx" + if (__pyx_t_8 > 0) + +# line 1276 "core/core2.pyx" + { + +# line 1276 "core/core2.pyx" + #ifdef _OPENMP + +# line 1276 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); + + /* "core/core2.pyx":1277 + * with nogil: + * for i in prange(self.engine.n_verts): + * self.engine.m.verts[i] = self.vec_data[i] # <<<<<<<<<<<<<< + * + * cpdef void masked_store(self, float factor=1, bint invert=False): + */ + +# line 1277 "core/core2.pyx" + (__pyx_v_self->engine->m->verts[__pyx_v_i]) = (__pyx_v_self->vec_data[__pyx_v_i]); + +# line 1277 "core/core2.pyx" + } + +# line 1277 "core/core2.pyx" + } + +# line 1277 "core/core2.pyx" + } + +# line 1277 "core/core2.pyx" + } + +# line 1277 "core/core2.pyx" + } + +# line 1277 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1277 "core/core2.pyx" + #undef likely + +# line 1277 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1277 "core/core2.pyx" + #endif + +# line 1277 "core/core2.pyx" + } + + /* "core/core2.pyx":1275 + * + * cdef int i + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * self.engine.m.verts[i] = self.vec_data[i] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":1270 + * self.vec_data[i] = self.engine.m.verts[i] + * + * cpdef void store(self): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("softwrap_core2.SpringEngineMask.store", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_11store(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_11store(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("store (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_10store(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_10store(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("store", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_16SpringEngineMask_store(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.store", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1279 + * self.engine.m.verts[i] = self.vec_data[i] + * + * cpdef void masked_store(self, float factor=1, bint invert=False): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_13masked_store(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_14softwrap_core2_16SpringEngineMask_masked_store(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_16SpringEngineMask_masked_store *__pyx_optional_args) { + float __pyx_v_factor = ((float)1.0); + int __pyx_v_invert = ((int)0); + int __pyx_v_i; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("masked_store", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_factor = __pyx_optional_args->factor; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_invert = __pyx_optional_args->invert; + } + } + } + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_masked_store); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_16SpringEngineMask_13masked_store)) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_factor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_invert); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1280 + * + * cpdef void masked_store(self, float factor=1, bint invert=False): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1280 "core/core2.pyx" + __pyx_t_9 = ((__pyx_v_self->mask == NULL) != 0); + +# line 1280 "core/core2.pyx" + if (__pyx_t_9) { + + /* "core/core2.pyx":1281 + * cpdef void masked_store(self, float factor=1, bint invert=False): + * if self.mask == NULL: + * return # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1281 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1280 + * + * cpdef void masked_store(self, float factor=1, bint invert=False): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1280 "core/core2.pyx" + } + + /* "core/core2.pyx":1284 + * + * cdef int i + * with nogil: # <<<<<<<<<<<<<< + * if invert: + * for i in prange(self.engine.n_verts): + */ + +# line 1284 "core/core2.pyx" + { + +# line 1284 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1284 "core/core2.pyx" + PyThreadState *_save; + +# line 1284 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1284 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1284 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1285 + * cdef int i + * with nogil: + * if invert: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], (1.0 - self.mask[i]) * factor) + */ + +# line 1285 "core/core2.pyx" + __pyx_t_9 = (__pyx_v_invert != 0); + +# line 1285 "core/core2.pyx" + if (__pyx_t_9) { + + /* "core/core2.pyx":1286 + * with nogil: + * if invert: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], (1.0 - self.mask[i]) * factor) + * else: + */ + +# line 1286 "core/core2.pyx" + __pyx_t_7 = __pyx_v_self->engine->n_verts; + +# line 1286 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1286 "core/core2.pyx" + { + +# line 1286 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1286 "core/core2.pyx" + #undef likely + +# line 1286 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1286 "core/core2.pyx" + #endif + +# line 1286 "core/core2.pyx" + __pyx_t_11 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1; + +# line 1286 "core/core2.pyx" + if (__pyx_t_11 > 0) + +# line 1286 "core/core2.pyx" + { + +# line 1286 "core/core2.pyx" + #ifdef _OPENMP + +# line 1286 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_10); + + /* "core/core2.pyx":1287 + * if invert: + * for i in prange(self.engine.n_verts): + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], (1.0 - self.mask[i]) * factor) # <<<<<<<<<<<<<< + * else: + * for i in prange(self.engine.n_verts): + */ + +# line 1287 "core/core2.pyx" + (__pyx_v_self->engine->m->verts[__pyx_v_i]) = (__pyx_v_self->engine->m->verts[__pyx_v_i]).lerp((__pyx_v_self->vec_data[__pyx_v_i]), ((((float)1.0) - (__pyx_v_self->mask[__pyx_v_i])) * __pyx_v_factor)); + +# line 1287 "core/core2.pyx" + } + +# line 1287 "core/core2.pyx" + } + +# line 1287 "core/core2.pyx" + } + +# line 1287 "core/core2.pyx" + } + +# line 1287 "core/core2.pyx" + } + +# line 1287 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1287 "core/core2.pyx" + #undef likely + +# line 1287 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1287 "core/core2.pyx" + #endif + + /* "core/core2.pyx":1285 + * cdef int i + * with nogil: + * if invert: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], (1.0 - self.mask[i]) * factor) + */ + +# line 1285 "core/core2.pyx" + goto __pyx_L7; + +# line 1285 "core/core2.pyx" + } + + /* "core/core2.pyx":1289 + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], (1.0 - self.mask[i]) * factor) + * else: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], self.mask[i] * factor) + * + */ + /*else*/ { + __pyx_t_11 = __pyx_v_self->engine->n_verts; + if ((1 == 0)) abort(); + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_7 = (__pyx_t_11 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_7 > 0) + { + #ifdef _OPENMP + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_7; __pyx_t_10++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_10); + + /* "core/core2.pyx":1290 + * else: + * for i in prange(self.engine.n_verts): + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], self.mask[i] * factor) # <<<<<<<<<<<<<< + * + * cpdef set(self, list vec_data): + */ + +# line 1290 "core/core2.pyx" + (__pyx_v_self->engine->m->verts[__pyx_v_i]) = (__pyx_v_self->engine->m->verts[__pyx_v_i]).lerp((__pyx_v_self->vec_data[__pyx_v_i]), ((__pyx_v_self->mask[__pyx_v_i]) * __pyx_v_factor)); + +# line 1290 "core/core2.pyx" + } + +# line 1290 "core/core2.pyx" + } + +# line 1290 "core/core2.pyx" + } + +# line 1290 "core/core2.pyx" + } + +# line 1290 "core/core2.pyx" + } + +# line 1290 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1290 "core/core2.pyx" + #undef likely + +# line 1290 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1290 "core/core2.pyx" + #endif + +# line 1290 "core/core2.pyx" + } + +# line 1290 "core/core2.pyx" + __pyx_L7:; + +# line 1290 "core/core2.pyx" + } + + /* "core/core2.pyx":1284 + * + * cdef int i + * with nogil: # <<<<<<<<<<<<<< + * if invert: + * for i in prange(self.engine.n_verts): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":1279 + * self.engine.m.verts[i] = self.vec_data[i] + * + * cpdef void masked_store(self, float factor=1, bint invert=False): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("softwrap_core2.SpringEngineMask.masked_store", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_13masked_store(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_13masked_store(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_factor; + int __pyx_v_invert; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("masked_store (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_factor,&__pyx_n_s_invert,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_invert); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "masked_store") < 0)) __PYX_ERR(0, 1279, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_factor = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1279, __pyx_L3_error) + } else { + __pyx_v_factor = ((float)1.0); + } + if (values[1]) { + __pyx_v_invert = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_invert == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1279, __pyx_L3_error) + } else { + __pyx_v_invert = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("masked_store", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1279, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.masked_store", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_12masked_store(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self), __pyx_v_factor, __pyx_v_invert); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_12masked_store(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, float __pyx_v_factor, int __pyx_v_invert) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_14softwrap_core2_16SpringEngineMask_masked_store __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("masked_store", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1.__pyx_n = 2; + __pyx_t_1.factor = __pyx_v_factor; + __pyx_t_1.invert = __pyx_v_invert; + __pyx_vtabptr_14softwrap_core2_SpringEngineMask->masked_store(__pyx_v_self, 1, &__pyx_t_1); + __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.masked_store", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1292 + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], self.mask[i] * factor) + * + * cpdef set(self, list vec_data): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_15set(PyObject *__pyx_v_self, PyObject *__pyx_v_vec_data); /*proto*/ +static PyObject *__pyx_f_14softwrap_core2_16SpringEngineMask_set(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, PyObject *__pyx_v_vec_data, int __pyx_skip_dispatch) { + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + long __pyx_t_7; + long __pyx_t_8; + int __pyx_t_9; + float __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_16SpringEngineMask_15set)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_vec_data) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_vec_data); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1293 + * + * cpdef set(self, list vec_data): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1293 "core/core2.pyx" + __pyx_t_5 = ((__pyx_v_self->mask == NULL) != 0); + +# line 1293 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1294 + * cpdef set(self, list vec_data): + * if self.mask == NULL: + * return # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1294 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 1294 "core/core2.pyx" + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + +# line 1294 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1293 + * + * cpdef set(self, list vec_data): + * if self.mask == NULL: # <<<<<<<<<<<<<< + * return + * + */ + +# line 1293 "core/core2.pyx" + } + + /* "core/core2.pyx":1297 + * + * cdef int i + * if not len(vec_data) == self.engine.n_verts * 3: # <<<<<<<<<<<<<< + * raise ValueError('vec_data must have the same number of elements as engine verts times 3') + * + */ + +# line 1297 "core/core2.pyx" + if (unlikely(__pyx_v_vec_data == Py_None)) { + +# line 1297 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1297 "core/core2.pyx" + __PYX_ERR(0, 1297, __pyx_L1_error) + +# line 1297 "core/core2.pyx" + } + +# line 1297 "core/core2.pyx" + __pyx_t_6 = PyList_GET_SIZE(__pyx_v_vec_data); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1297, __pyx_L1_error) + +# line 1297 "core/core2.pyx" + __pyx_t_5 = ((!((__pyx_t_6 == (__pyx_v_self->engine->n_verts * 3)) != 0)) != 0); + +# line 1297 "core/core2.pyx" + if (unlikely(__pyx_t_5)) { + + /* "core/core2.pyx":1298 + * cdef int i + * if not len(vec_data) == self.engine.n_verts * 3: + * raise ValueError('vec_data must have the same number of elements as engine verts times 3') # <<<<<<<<<<<<<< + * + * for i in range(self.engine.n_verts * 3): + */ + +# line 1298 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1298, __pyx_L1_error) + +# line 1298 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1298 "core/core2.pyx" + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + +# line 1298 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1298 "core/core2.pyx" + __PYX_ERR(0, 1298, __pyx_L1_error) + + /* "core/core2.pyx":1297 + * + * cdef int i + * if not len(vec_data) == self.engine.n_verts * 3: # <<<<<<<<<<<<<< + * raise ValueError('vec_data must have the same number of elements as engine verts times 3') + * + */ + +# line 1297 "core/core2.pyx" + } + + /* "core/core2.pyx":1300 + * raise ValueError('vec_data must have the same number of elements as engine verts times 3') + * + * for i in range(self.engine.n_verts * 3): # <<<<<<<<<<<<<< + * self.vec_data[i // 3].v[i % 3] = vec_data[i] + * + */ + +# line 1300 "core/core2.pyx" + __pyx_t_7 = (__pyx_v_self->engine->n_verts * 3); + +# line 1300 "core/core2.pyx" + __pyx_t_8 = __pyx_t_7; + +# line 1300 "core/core2.pyx" + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + +# line 1300 "core/core2.pyx" + __pyx_v_i = __pyx_t_9; + + /* "core/core2.pyx":1301 + * + * for i in range(self.engine.n_verts * 3): + * self.vec_data[i // 3].v[i % 3] = vec_data[i] # <<<<<<<<<<<<<< + * + * def masked_context(self, float factor=1, bint invert=False): + */ + +# line 1301 "core/core2.pyx" + if (unlikely(__pyx_v_vec_data == Py_None)) { + +# line 1301 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1301 "core/core2.pyx" + __PYX_ERR(0, 1301, __pyx_L1_error) + +# line 1301 "core/core2.pyx" + } + +# line 1301 "core/core2.pyx" + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_vec_data, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1301, __pyx_L1_error) + +# line 1301 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1301 "core/core2.pyx" + __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1301, __pyx_L1_error) + +# line 1301 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1301 "core/core2.pyx" + ((__pyx_v_self->vec_data[(__pyx_v_i / 3)]).v[(__pyx_v_i % 3)]) = __pyx_t_10; + +# line 1301 "core/core2.pyx" + } + + /* "core/core2.pyx":1292 + * self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], self.mask[i] * factor) + * + * cpdef set(self, list vec_data): # <<<<<<<<<<<<<< + * if self.mask == NULL: + * return + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_15set(PyObject *__pyx_v_self, PyObject *__pyx_v_vec_data); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_15set(PyObject *__pyx_v_self, PyObject *__pyx_v_vec_data) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec_data), (&PyList_Type), 1, "vec_data", 1))) __PYX_ERR(0, 1292, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_14set(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self), ((PyObject*)__pyx_v_vec_data)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_14set(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, PyObject *__pyx_v_vec_data) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_14softwrap_core2_16SpringEngineMask_set(__pyx_v_self, __pyx_v_vec_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1303 + * self.vec_data[i // 3].v[i % 3] = vec_data[i] + * + * def masked_context(self, float factor=1, bint invert=False): # <<<<<<<<<<<<<< + * return _MaskContextManager(self, factor, invert) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_17masked_context(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_17masked_context(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_factor; + int __pyx_v_invert; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("masked_context (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_factor,&__pyx_n_s_invert,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_invert); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "masked_context") < 0)) __PYX_ERR(0, 1303, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_factor = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1303, __pyx_L3_error) + } else { + __pyx_v_factor = ((float)1.0); + } + if (values[1]) { + __pyx_v_invert = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_invert == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1303, __pyx_L3_error) + } else { + __pyx_v_invert = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("masked_context", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1303, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.masked_context", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_16masked_context(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self), __pyx_v_factor, __pyx_v_invert); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_16masked_context(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, float __pyx_v_factor, int __pyx_v_invert) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("masked_context", 0); + + /* "core/core2.pyx":1304 + * + * def masked_context(self, float factor=1, bint invert=False): + * return _MaskContextManager(self, factor, invert) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + +# line 1304 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 1304 "core/core2.pyx" + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1304, __pyx_L1_error) + +# line 1304 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1304 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_invert); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1304, __pyx_L1_error) + +# line 1304 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1304 "core/core2.pyx" + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1304, __pyx_L1_error) + +# line 1304 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 1304 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + +# line 1304 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + +# line 1304 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + +# line 1304 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_1); + +# line 1304 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + +# line 1304 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_2); + +# line 1304 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + +# line 1304 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 1304 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 1304 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14softwrap_core2__MaskContextManager), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1304, __pyx_L1_error) + +# line 1304 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1304 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 1304 "core/core2.pyx" + __pyx_r = __pyx_t_2; + +# line 1304 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 1304 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1303 + * self.vec_data[i // 3].v[i % 3] = vec_data[i] + * + * def masked_context(self, float factor=1, bint invert=False): # <<<<<<<<<<<<<< + * return _MaskContextManager(self, factor, invert) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.masked_context", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1306 + * return _MaskContextManager(self, factor, invert) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.vec_data) + * fraeee(self.mask) + */ + +/* Python wrapper */ +static void __pyx_pw_14softwrap_core2_16SpringEngineMask_19__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_14softwrap_core2_16SpringEngineMask_19__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_14softwrap_core2_16SpringEngineMask_18__dealloc__(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_14softwrap_core2_16SpringEngineMask_18__dealloc__(struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "core/core2.pyx":1307 + * + * def __dealloc__(self): + * fraeee(self.vec_data) # <<<<<<<<<<<<<< + * fraeee(self.mask) + * + */ + +# line 1307 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->vec_data); + + /* "core/core2.pyx":1308 + * def __dealloc__(self): + * fraeee(self.vec_data) + * fraeee(self.mask) # <<<<<<<<<<<<<< + * + * + */ + +# line 1308 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->mask); + + /* "core/core2.pyx":1306 + * return _MaskContextManager(self, factor, invert) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.vec_data) + * fraeee(self.mask) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_20__reduce_cython__(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_16SpringEngineMask_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_16SpringEngineMask_22__setstate_cython__(((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_16SpringEngineMask_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngineMask.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1318 + * cdef readonly float[3] error + * + * def __cinit__(self, SpringEngine engine): # <<<<<<<<<<<<<< + * if engine == None: + * raise ValueError + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_11SymmetryMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_11SymmetryMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_engine,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_engine)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1318, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1318, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_engine), __pyx_ptype_14softwrap_core2_SpringEngine, 1, "engine", 0))) __PYX_ERR(0, 1318, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_11SymmetryMap___cinit__(((struct __pyx_obj_14softwrap_core2_SymmetryMap *)__pyx_v_self), __pyx_v_engine); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_11SymmetryMap___cinit__(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_engine) { + struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_bvh = 0; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_axis; + int __pyx_v_v_index; + struct BvhNearestResult __pyx_v_result; + vec3 __pyx_v_v; + double __pyx_v_dist; + double __pyx_v_tmp_dist; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + void *__pyx_t_3; + float *__pyx_t_4; + float __pyx_t_5; + float __pyx_t_6; + float __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "core/core2.pyx":1319 + * + * def __cinit__(self, SpringEngine engine): + * if engine == None: # <<<<<<<<<<<<<< + * raise ValueError + * cdef BVH bvh = BVH(engine.m) + */ + +# line 1319 "core/core2.pyx" + __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_engine), Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1319, __pyx_L1_error) + +# line 1319 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1319, __pyx_L1_error) + +# line 1319 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1319 "core/core2.pyx" + if (unlikely(__pyx_t_2)) { + + /* "core/core2.pyx":1320 + * def __cinit__(self, SpringEngine engine): + * if engine == None: + * raise ValueError # <<<<<<<<<<<<<< + * cdef BVH bvh = BVH(engine.m) + * self.engine = engine + */ + +# line 1320 "core/core2.pyx" + __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0); + +# line 1320 "core/core2.pyx" + __PYX_ERR(0, 1320, __pyx_L1_error) + + /* "core/core2.pyx":1319 + * + * def __cinit__(self, SpringEngine engine): + * if engine == None: # <<<<<<<<<<<<<< + * raise ValueError + * cdef BVH bvh = BVH(engine.m) + */ + +# line 1319 "core/core2.pyx" + } + + /* "core/core2.pyx":1321 + * if engine == None: + * raise ValueError + * cdef BVH bvh = BVH(engine.m) # <<<<<<<<<<<<<< + * self.engine = engine + * self.symm_map = maelloc(sizeof(int) * engine.n_verts * 3, __LINE__) + */ + +# line 1321 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_14softwrap_core2_BVH), ((PyObject *)__pyx_v_engine->m)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1321, __pyx_L1_error) + +# line 1321 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1321 "core/core2.pyx" + __pyx_v_bvh = ((struct __pyx_obj_14softwrap_core2_BVH *)__pyx_t_1); + +# line 1321 "core/core2.pyx" + __pyx_t_1 = 0; + + /* "core/core2.pyx":1322 + * raise ValueError + * cdef BVH bvh = BVH(engine.m) + * self.engine = engine # <<<<<<<<<<<<<< + * self.symm_map = maelloc(sizeof(int) * engine.n_verts * 3, __LINE__) + * + */ + +# line 1322 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_engine)); + +# line 1322 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_engine)); + +# line 1322 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->engine); + +# line 1322 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->engine)); + +# line 1322 "core/core2.pyx" + __pyx_v_self->engine = __pyx_v_engine; + + /* "core/core2.pyx":1323 + * cdef BVH bvh = BVH(engine.m) + * self.engine = engine + * self.symm_map = maelloc(sizeof(int) * engine.n_verts * 3, __LINE__) # <<<<<<<<<<<<<< + * + * cdef int i, j, axis, v_index + */ + +# line 1323 "core/core2.pyx" + __pyx_t_3 = __pyx_f_14softwrap_core2_maelloc((((sizeof(int)) * __pyx_v_engine->n_verts) * 3), __LINE__); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 1323, __pyx_L1_error) + +# line 1323 "core/core2.pyx" + __pyx_v_self->symm_map = ((int *)__pyx_t_3); + + /* "core/core2.pyx":1330 + * cdef double dist, tmp_dist + * + * self.error = (0, 0, 0) # <<<<<<<<<<<<<< + * + * with nogil: + */ + +# line 1330 "core/core2.pyx" + __pyx_t_4 = __pyx_v_self->error; + +# line 1330 "core/core2.pyx" + __pyx_t_5 = 0.0; + +# line 1330 "core/core2.pyx" + __pyx_t_6 = 0.0; + +# line 1330 "core/core2.pyx" + __pyx_t_7 = 0.0; + +# line 1330 "core/core2.pyx" + (__pyx_t_4[0]) = __pyx_t_5; + +# line 1330 "core/core2.pyx" + (__pyx_t_4[1]) = __pyx_t_6; + +# line 1330 "core/core2.pyx" + (__pyx_t_4[2]) = __pyx_t_7; + + /* "core/core2.pyx":1332 + * self.error = (0, 0, 0) + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * for axis in range(3): + */ + +# line 1332 "core/core2.pyx" + { + +# line 1332 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1332 "core/core2.pyx" + PyThreadState *_save; + +# line 1332 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1332 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1332 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1333 + * + * with nogil: + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * for axis in range(3): + * dist = INFINITY + */ + +# line 1333 "core/core2.pyx" + __pyx_t_8 = __pyx_v_self->engine->n_verts; + +# line 1333 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1333 "core/core2.pyx" + { + +# line 1333 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1333 "core/core2.pyx" + #undef likely + +# line 1333 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1333 "core/core2.pyx" + #endif + +# line 1333 "core/core2.pyx" + __pyx_t_10 = (__pyx_t_8 - 0 + 1 - 1/abs(1)) / 1; + +# line 1333 "core/core2.pyx" + if (__pyx_t_10 > 0) + +# line 1333 "core/core2.pyx" + { + +# line 1333 "core/core2.pyx" + #ifdef _OPENMP + +# line 1333 "core/core2.pyx" + #pragma omp parallel private(__pyx_t_11, __pyx_t_12, __pyx_t_2) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_axis) lastprivate(__pyx_v_dist) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) lastprivate(__pyx_v_tmp_dist) lastprivate(__pyx_v_v) lastprivate(__pyx_v_v_index) + #endif /* _OPENMP */ + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_9); + /* Initialize private variables to invalid values */ + __pyx_v_axis = ((int)0xbad0bad0); + __pyx_v_dist = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_tmp_dist = ((double)__PYX_NAN()); + __pyx_v_v_index = ((int)0xbad0bad0); + + /* "core/core2.pyx":1334 + * with nogil: + * for i in prange(self.engine.n_verts): + * for axis in range(3): # <<<<<<<<<<<<<< + * dist = INFINITY + * v = self.engine.m.verts[i] + */ + +# line 1334 "core/core2.pyx" + for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { + +# line 1334 "core/core2.pyx" + __pyx_v_axis = __pyx_t_11; + + /* "core/core2.pyx":1335 + * for i in prange(self.engine.n_verts): + * for axis in range(3): + * dist = INFINITY # <<<<<<<<<<<<<< + * v = self.engine.m.verts[i] + * v.v[axis] = -v.v[axis] + */ + +# line 1335 "core/core2.pyx" + __pyx_v_dist = INFINITY; + + /* "core/core2.pyx":1336 + * for axis in range(3): + * dist = INFINITY + * v = self.engine.m.verts[i] # <<<<<<<<<<<<<< + * v.v[axis] = -v.v[axis] + * + */ + +# line 1336 "core/core2.pyx" + __pyx_v_v = (__pyx_v_self->engine->m->verts[__pyx_v_i]); + + /* "core/core2.pyx":1337 + * dist = INFINITY + * v = self.engine.m.verts[i] + * v.v[axis] = -v.v[axis] # <<<<<<<<<<<<<< + * + * result = bvh._find_nearest(v) + */ + +# line 1337 "core/core2.pyx" + (__pyx_v_v.v[__pyx_v_axis]) = (-(__pyx_v_v.v[__pyx_v_axis])); + + /* "core/core2.pyx":1339 + * v.v[axis] = -v.v[axis] + * + * result = bvh._find_nearest(v) # <<<<<<<<<<<<<< + * for j in range(3): + * v_index = self.engine.m.triangles[result.tri_index][j] + */ + +# line 1339 "core/core2.pyx" + __pyx_v_result = __pyx_f_14softwrap_core2_3BVH__find_nearest(__pyx_v_bvh, __pyx_v_v); + + /* "core/core2.pyx":1340 + * + * result = bvh._find_nearest(v) + * for j in range(3): # <<<<<<<<<<<<<< + * v_index = self.engine.m.triangles[result.tri_index][j] + * tmp_dist = (self.engine.m.verts[v_index] - v).len() + */ + +# line 1340 "core/core2.pyx" + for (__pyx_t_12 = 0; __pyx_t_12 < 3; __pyx_t_12+=1) { + +# line 1340 "core/core2.pyx" + __pyx_v_j = __pyx_t_12; + + /* "core/core2.pyx":1341 + * result = bvh._find_nearest(v) + * for j in range(3): + * v_index = self.engine.m.triangles[result.tri_index][j] # <<<<<<<<<<<<<< + * tmp_dist = (self.engine.m.verts[v_index] - v).len() + * if tmp_dist < dist: + */ + +# line 1341 "core/core2.pyx" + __pyx_v_v_index = ((__pyx_v_self->engine->m->triangles[__pyx_v_result.tri_index])[__pyx_v_j]); + + /* "core/core2.pyx":1342 + * for j in range(3): + * v_index = self.engine.m.triangles[result.tri_index][j] + * tmp_dist = (self.engine.m.verts[v_index] - v).len() # <<<<<<<<<<<<<< + * if tmp_dist < dist: + * dist = tmp_dist + */ + +# line 1342 "core/core2.pyx" + __pyx_v_tmp_dist = ((__pyx_v_self->engine->m->verts[__pyx_v_v_index]) - __pyx_v_v).len(); + + /* "core/core2.pyx":1343 + * v_index = self.engine.m.triangles[result.tri_index][j] + * tmp_dist = (self.engine.m.verts[v_index] - v).len() + * if tmp_dist < dist: # <<<<<<<<<<<<<< + * dist = tmp_dist + * self.symm_map[i + self.engine.m.n_verts * axis] = v_index + */ + +# line 1343 "core/core2.pyx" + __pyx_t_2 = ((__pyx_v_tmp_dist < __pyx_v_dist) != 0); + +# line 1343 "core/core2.pyx" + if (__pyx_t_2) { + + /* "core/core2.pyx":1344 + * tmp_dist = (self.engine.m.verts[v_index] - v).len() + * if tmp_dist < dist: + * dist = tmp_dist # <<<<<<<<<<<<<< + * self.symm_map[i + self.engine.m.n_verts * axis] = v_index + * self.error[axis] = nmax(dist, self.error[axis]) + */ + +# line 1344 "core/core2.pyx" + __pyx_v_dist = __pyx_v_tmp_dist; + + /* "core/core2.pyx":1345 + * if tmp_dist < dist: + * dist = tmp_dist + * self.symm_map[i + self.engine.m.n_verts * axis] = v_index # <<<<<<<<<<<<<< + * self.error[axis] = nmax(dist, self.error[axis]) + * + */ + +# line 1345 "core/core2.pyx" + (__pyx_v_self->symm_map[(__pyx_v_i + (__pyx_v_self->engine->m->n_verts * __pyx_v_axis))]) = __pyx_v_v_index; + + /* "core/core2.pyx":1343 + * v_index = self.engine.m.triangles[result.tri_index][j] + * tmp_dist = (self.engine.m.verts[v_index] - v).len() + * if tmp_dist < dist: # <<<<<<<<<<<<<< + * dist = tmp_dist + * self.symm_map[i + self.engine.m.n_verts * axis] = v_index + */ + +# line 1343 "core/core2.pyx" + } + +# line 1343 "core/core2.pyx" + } + + /* "core/core2.pyx":1346 + * dist = tmp_dist + * self.symm_map[i + self.engine.m.n_verts * axis] = v_index + * self.error[axis] = nmax(dist, self.error[axis]) # <<<<<<<<<<<<<< + * + * def __getitem__(self, int index): + */ + +# line 1346 "core/core2.pyx" + (__pyx_v_self->error[__pyx_v_axis]) = nmax(__pyx_v_dist, (__pyx_v_self->error[__pyx_v_axis])); + +# line 1346 "core/core2.pyx" + } + +# line 1346 "core/core2.pyx" + } + +# line 1346 "core/core2.pyx" + } + +# line 1346 "core/core2.pyx" + } + +# line 1346 "core/core2.pyx" + } + +# line 1346 "core/core2.pyx" + } + +# line 1346 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1346 "core/core2.pyx" + #undef likely + +# line 1346 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1346 "core/core2.pyx" + #endif + +# line 1346 "core/core2.pyx" + } + + /* "core/core2.pyx":1332 + * self.error = (0, 0, 0) + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.engine.n_verts): + * for axis in range(3): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":1318 + * cdef readonly float[3] error + * + * def __cinit__(self, SpringEngine engine): # <<<<<<<<<<<<<< + * if engine == None: + * raise ValueError + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_bvh); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1348 + * self.error[axis] = nmax(dist, self.error[axis]) + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if index < 0 or index >= self.engine.n_verts: + * raise KeyError + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { + int __pyx_v_index; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + assert(__pyx_arg_index); { + __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1348, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_11SymmetryMap_2__getitem__(((struct __pyx_obj_14softwrap_core2_SymmetryMap *)__pyx_v_self), ((int)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_14softwrap_core2_11SymmetryMap_11__getitem___2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "core/core2.pyx":1352 + * raise KeyError + * + * return tuple(self.symm_map[index + axis * self.engine.n_verts] for axis in range(3)) # <<<<<<<<<<<<<< + * + * cpdef void mirror(self, bint x, bint y, bint z): + */ + + +# line 1352 "core/core2.pyx" +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_11__getitem___genexpr(PyObject *__pyx_self) { + +# line 1352 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *__pyx_cur_scope; + +# line 1352 "core/core2.pyx" + PyObject *__pyx_r = NULL; + +# line 1352 "core/core2.pyx" + __Pyx_RefNannyDeclarations + +# line 1352 "core/core2.pyx" + int __pyx_lineno = 0; + +# line 1352 "core/core2.pyx" + const char *__pyx_filename = NULL; + +# line 1352 "core/core2.pyx" + int __pyx_clineno = 0; + +# line 1352 "core/core2.pyx" + __Pyx_RefNannySetupContext("genexpr", 0); + +# line 1352 "core/core2.pyx" + __pyx_cur_scope = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *)__pyx_tp_new_14softwrap_core2___pyx_scope_struct_5_genexpr(__pyx_ptype_14softwrap_core2___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL); + +# line 1352 "core/core2.pyx" + if (unlikely(!__pyx_cur_scope)) { + +# line 1352 "core/core2.pyx" + __pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *)Py_None); + +# line 1352 "core/core2.pyx" + __Pyx_INCREF(Py_None); + +# line 1352 "core/core2.pyx" + __PYX_ERR(0, 1352, __pyx_L1_error) + +# line 1352 "core/core2.pyx" + } else { + +# line 1352 "core/core2.pyx" + __Pyx_GOTREF(__pyx_cur_scope); + +# line 1352 "core/core2.pyx" + } + +# line 1352 "core/core2.pyx" + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *) __pyx_self; + +# line 1352 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); + +# line 1352 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); + +# line 1352 "core/core2.pyx" + { + +# line 1352 "core/core2.pyx" + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_14softwrap_core2_11SymmetryMap_11__getitem___2generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_getitem___locals_genexpr, __pyx_n_s_softwrap_core2); if (unlikely(!gen)) __PYX_ERR(0, 1352, __pyx_L1_error) + +# line 1352 "core/core2.pyx" + __Pyx_DECREF(__pyx_cur_scope); + +# line 1352 "core/core2.pyx" + __Pyx_RefNannyFinishContext(); + +# line 1352 "core/core2.pyx" + return (PyObject *) gen; + +# line 1352 "core/core2.pyx" + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.__getitem__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_14softwrap_core2_11SymmetryMap_11__getitem___2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + long __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1352, __pyx_L1_error) + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_axis); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_axis, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1352, __pyx_L1_error) } + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1352, __pyx_L1_error) } + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->engine->n_verts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(__pyx_cur_scope->__pyx_v_axis, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1352, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->symm_map[__pyx_t_5])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1352, __pyx_L1_error) + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); __pyx_r = 0; + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1348 + * self.error[axis] = nmax(dist, self.error[axis]) + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if index < 0 or index >= self.engine.n_verts: + * raise KeyError + */ + + +# line 1348 "core/core2.pyx" +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_2__getitem__(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, int __pyx_v_index) { + +# line 1348 "core/core2.pyx" + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *__pyx_cur_scope; + +# line 1348 "core/core2.pyx" + PyObject *__pyx_gb_14softwrap_core2_11SymmetryMap_11__getitem___2generator3 = 0; + +# line 1348 "core/core2.pyx" + PyObject *__pyx_r = NULL; + +# line 1348 "core/core2.pyx" + __Pyx_RefNannyDeclarations + +# line 1348 "core/core2.pyx" + int __pyx_t_1; + +# line 1348 "core/core2.pyx" + int __pyx_t_2; + +# line 1348 "core/core2.pyx" + PyObject *__pyx_t_3 = NULL; + +# line 1348 "core/core2.pyx" + PyObject *__pyx_t_4 = NULL; + +# line 1348 "core/core2.pyx" + int __pyx_lineno = 0; + +# line 1348 "core/core2.pyx" + const char *__pyx_filename = NULL; + +# line 1348 "core/core2.pyx" + int __pyx_clineno = 0; + +# line 1348 "core/core2.pyx" + __Pyx_RefNannySetupContext("__getitem__", 0); + +# line 1348 "core/core2.pyx" + __pyx_cur_scope = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *)__pyx_tp_new_14softwrap_core2___pyx_scope_struct_4___getitem__(__pyx_ptype_14softwrap_core2___pyx_scope_struct_4___getitem__, __pyx_empty_tuple, NULL); + +# line 1348 "core/core2.pyx" + if (unlikely(!__pyx_cur_scope)) { + +# line 1348 "core/core2.pyx" + __pyx_cur_scope = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *)Py_None); + +# line 1348 "core/core2.pyx" + __Pyx_INCREF(Py_None); + +# line 1348 "core/core2.pyx" + __PYX_ERR(0, 1348, __pyx_L1_error) + +# line 1348 "core/core2.pyx" + } else { + +# line 1348 "core/core2.pyx" + __Pyx_GOTREF(__pyx_cur_scope); + +# line 1348 "core/core2.pyx" + } + +# line 1348 "core/core2.pyx" + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + +# line 1348 "core/core2.pyx" + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + +# line 1348 "core/core2.pyx" + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + +# line 1348 "core/core2.pyx" + __pyx_cur_scope->__pyx_v_index = __pyx_v_index; + + /* "core/core2.pyx":1349 + * + * def __getitem__(self, int index): + * if index < 0 or index >= self.engine.n_verts: # <<<<<<<<<<<<<< + * raise KeyError + * + */ + +# line 1349 "core/core2.pyx" + __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_index < 0) != 0); + +# line 1349 "core/core2.pyx" + if (!__pyx_t_2) { + +# line 1349 "core/core2.pyx" + } else { + +# line 1349 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 1349 "core/core2.pyx" + goto __pyx_L4_bool_binop_done; + +# line 1349 "core/core2.pyx" + } + +# line 1349 "core/core2.pyx" + __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_index >= __pyx_cur_scope->__pyx_v_self->engine->n_verts) != 0); + +# line 1349 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 1349 "core/core2.pyx" + __pyx_L4_bool_binop_done:; + +# line 1349 "core/core2.pyx" + if (unlikely(__pyx_t_1)) { + + /* "core/core2.pyx":1350 + * def __getitem__(self, int index): + * if index < 0 or index >= self.engine.n_verts: + * raise KeyError # <<<<<<<<<<<<<< + * + * return tuple(self.symm_map[index + axis * self.engine.n_verts] for axis in range(3)) + */ + +# line 1350 "core/core2.pyx" + __Pyx_Raise(__pyx_builtin_KeyError, 0, 0, 0); + +# line 1350 "core/core2.pyx" + __PYX_ERR(0, 1350, __pyx_L1_error) + + /* "core/core2.pyx":1349 + * + * def __getitem__(self, int index): + * if index < 0 or index >= self.engine.n_verts: # <<<<<<<<<<<<<< + * raise KeyError + * + */ + +# line 1349 "core/core2.pyx" + } + + /* "core/core2.pyx":1352 + * raise KeyError + * + * return tuple(self.symm_map[index + axis * self.engine.n_verts] for axis in range(3)) # <<<<<<<<<<<<<< + * + * cpdef void mirror(self, bint x, bint y, bint z): + */ + +# line 1352 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 1352 "core/core2.pyx" + __pyx_t_3 = __pyx_pf_14softwrap_core2_11SymmetryMap_11__getitem___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1352, __pyx_L1_error) + +# line 1352 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 1352 "core/core2.pyx" + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1352, __pyx_L1_error) + +# line 1352 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1352 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 1352 "core/core2.pyx" + __pyx_r = __pyx_t_4; + +# line 1352 "core/core2.pyx" + __pyx_t_4 = 0; + +# line 1352 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1348 + * self.error[axis] = nmax(dist, self.error[axis]) + * + * def __getitem__(self, int index): # <<<<<<<<<<<<<< + * if index < 0 or index >= self.engine.n_verts: + * raise KeyError + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_gb_14softwrap_core2_11SymmetryMap_11__getitem___2generator3); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1354 + * return tuple(self.symm_map[index + axis * self.engine.n_verts] for axis in range(3)) + * + * cpdef void mirror(self, bint x, bint y, bint z): # <<<<<<<<<<<<<< + * cdef int i, j, axis, v_index + * cdef int[3] mirror = (x, y, z) + */ + +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_5mirror(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_14softwrap_core2_11SymmetryMap_mirror(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, int __pyx_v_x, int __pyx_v_y, int __pyx_v_z, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_axis; + int __pyx_v_v_index; + int __pyx_v_mirror[3]; + vec3 __pyx_v_v; + __Pyx_RefNannyDeclarations + int *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + vec3 *__pyx_t_9; + vec3 *__pyx_t_10; + __Pyx_RefNannySetupContext("mirror", 0); + + /* "core/core2.pyx":1356 + * cpdef void mirror(self, bint x, bint y, bint z): + * cdef int i, j, axis, v_index + * cdef int[3] mirror = (x, y, z) # <<<<<<<<<<<<<< + * cdef vec3 v + * + */ + +# line 1356 "core/core2.pyx" + __pyx_t_1 = __pyx_v_mirror; + +# line 1356 "core/core2.pyx" + __pyx_t_2 = __pyx_v_x; + +# line 1356 "core/core2.pyx" + __pyx_t_3 = __pyx_v_y; + +# line 1356 "core/core2.pyx" + __pyx_t_4 = __pyx_v_z; + +# line 1356 "core/core2.pyx" + (__pyx_t_1[0]) = __pyx_t_2; + +# line 1356 "core/core2.pyx" + (__pyx_t_1[1]) = __pyx_t_3; + +# line 1356 "core/core2.pyx" + (__pyx_t_1[2]) = __pyx_t_4; + + /* "core/core2.pyx":1359 + * cdef vec3 v + * + * with nogil: # <<<<<<<<<<<<<< + * for axis in range(3): + * if not mirror[axis]: + */ + +# line 1359 "core/core2.pyx" + { + +# line 1359 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1359 "core/core2.pyx" + PyThreadState *_save; + +# line 1359 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1359 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1359 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1360 + * + * with nogil: + * for axis in range(3): # <<<<<<<<<<<<<< + * if not mirror[axis]: + * continue + */ + +# line 1360 "core/core2.pyx" + for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { + +# line 1360 "core/core2.pyx" + __pyx_v_axis = __pyx_t_5; + + /* "core/core2.pyx":1361 + * with nogil: + * for axis in range(3): + * if not mirror[axis]: # <<<<<<<<<<<<<< + * continue + * + */ + +# line 1361 "core/core2.pyx" + __pyx_t_4 = ((!((__pyx_v_mirror[__pyx_v_axis]) != 0)) != 0); + +# line 1361 "core/core2.pyx" + if (__pyx_t_4) { + + /* "core/core2.pyx":1362 + * for axis in range(3): + * if not mirror[axis]: + * continue # <<<<<<<<<<<<<< + * + * for i in prange(self.engine.n_verts): + */ + +# line 1362 "core/core2.pyx" + goto __pyx_L6_continue; + + /* "core/core2.pyx":1361 + * with nogil: + * for axis in range(3): + * if not mirror[axis]: # <<<<<<<<<<<<<< + * continue + * + */ + +# line 1361 "core/core2.pyx" + } + + /* "core/core2.pyx":1364 + * continue + * + * for i in prange(self.engine.n_verts): # <<<<<<<<<<<<<< + * v_index = self.symm_map[i + axis * self.engine.m.n_verts] + * v = self.engine.m.verts[v_index] + */ + +# line 1364 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->engine->n_verts; + +# line 1364 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1364 "core/core2.pyx" + { + +# line 1364 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1364 "core/core2.pyx" + #undef likely + +# line 1364 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1364 "core/core2.pyx" + #endif + +# line 1364 "core/core2.pyx" + __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; + +# line 1364 "core/core2.pyx" + if (__pyx_t_8 > 0) + +# line 1364 "core/core2.pyx" + { + +# line 1364 "core/core2.pyx" + #ifdef _OPENMP + +# line 1364 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_v) lastprivate(__pyx_v_v_index) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); + /* Initialize private variables to invalid values */ + __pyx_v_v_index = ((int)0xbad0bad0); + + /* "core/core2.pyx":1365 + * + * for i in prange(self.engine.n_verts): + * v_index = self.symm_map[i + axis * self.engine.m.n_verts] # <<<<<<<<<<<<<< + * v = self.engine.m.verts[v_index] + * v.v[axis] = -v.v[axis] + */ + +# line 1365 "core/core2.pyx" + __pyx_v_v_index = (__pyx_v_self->symm_map[(__pyx_v_i + (__pyx_v_axis * __pyx_v_self->engine->m->n_verts))]); + + /* "core/core2.pyx":1366 + * for i in prange(self.engine.n_verts): + * v_index = self.symm_map[i + axis * self.engine.m.n_verts] + * v = self.engine.m.verts[v_index] # <<<<<<<<<<<<<< + * v.v[axis] = -v.v[axis] + * self.engine.tmp_verts[i] = (self.engine.m.verts[i] + v) * 0.5 + */ + +# line 1366 "core/core2.pyx" + __pyx_v_v = (__pyx_v_self->engine->m->verts[__pyx_v_v_index]); + + /* "core/core2.pyx":1367 + * v_index = self.symm_map[i + axis * self.engine.m.n_verts] + * v = self.engine.m.verts[v_index] + * v.v[axis] = -v.v[axis] # <<<<<<<<<<<<<< + * self.engine.tmp_verts[i] = (self.engine.m.verts[i] + v) * 0.5 + * + */ + +# line 1367 "core/core2.pyx" + (__pyx_v_v.v[__pyx_v_axis]) = (-(__pyx_v_v.v[__pyx_v_axis])); + + /* "core/core2.pyx":1368 + * v = self.engine.m.verts[v_index] + * v.v[axis] = -v.v[axis] + * self.engine.tmp_verts[i] = (self.engine.m.verts[i] + v) * 0.5 # <<<<<<<<<<<<<< + * + * self.engine.tmp_verts, self.engine.m.verts = self.engine.m.verts, self.engine.tmp_verts + */ + +# line 1368 "core/core2.pyx" + (__pyx_v_self->engine->tmp_verts[__pyx_v_i]) = (((__pyx_v_self->engine->m->verts[__pyx_v_i]) + __pyx_v_v) * 0.5); + +# line 1368 "core/core2.pyx" + } + +# line 1368 "core/core2.pyx" + } + +# line 1368 "core/core2.pyx" + } + +# line 1368 "core/core2.pyx" + } + +# line 1368 "core/core2.pyx" + } + +# line 1368 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1368 "core/core2.pyx" + #undef likely + +# line 1368 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1368 "core/core2.pyx" + #endif + + /* "core/core2.pyx":1370 + * self.engine.tmp_verts[i] = (self.engine.m.verts[i] + v) * 0.5 + * + * self.engine.tmp_verts, self.engine.m.verts = self.engine.m.verts, self.engine.tmp_verts # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + +# line 1370 "core/core2.pyx" + __pyx_t_9 = __pyx_v_self->engine->m->verts; + +# line 1370 "core/core2.pyx" + __pyx_t_10 = __pyx_v_self->engine->tmp_verts; + +# line 1370 "core/core2.pyx" + __pyx_v_self->engine->tmp_verts = __pyx_t_9; + +# line 1370 "core/core2.pyx" + __pyx_v_self->engine->m->verts = __pyx_t_10; + +# line 1370 "core/core2.pyx" + __pyx_L6_continue:; + +# line 1370 "core/core2.pyx" + } + +# line 1370 "core/core2.pyx" + } + + /* "core/core2.pyx":1359 + * cdef vec3 v + * + * with nogil: # <<<<<<<<<<<<<< + * for axis in range(3): + * if not mirror[axis]: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "core/core2.pyx":1354 + * return tuple(self.symm_map[index + axis * self.engine.n_verts] for axis in range(3)) + * + * cpdef void mirror(self, bint x, bint y, bint z): # <<<<<<<<<<<<<< + * cdef int i, j, axis, v_index + * cdef int[3] mirror = (x, y, z) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_5mirror(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_5mirror(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_x; + int __pyx_v_y; + int __pyx_v_z; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mirror (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("mirror", 1, 3, 3, 1); __PYX_ERR(0, 1354, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("mirror", 1, 3, 3, 2); __PYX_ERR(0, 1354, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mirror") < 0)) __PYX_ERR(0, 1354, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_x = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1354, __pyx_L3_error) + __pyx_v_y = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_y == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1354, __pyx_L3_error) + __pyx_v_z = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_z == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1354, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("mirror", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1354, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.mirror", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_11SymmetryMap_4mirror(((struct __pyx_obj_14softwrap_core2_SymmetryMap *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_4mirror(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, int __pyx_v_x, int __pyx_v_y, int __pyx_v_z) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mirror", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_11SymmetryMap_mirror(__pyx_v_self, __pyx_v_x, __pyx_v_y, __pyx_v_z, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1354, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.mirror", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1372 + * self.engine.tmp_verts, self.engine.m.verts = self.engine.m.verts, self.engine.tmp_verts + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.symm_map) + * + */ + +/* Python wrapper */ +static void __pyx_pw_14softwrap_core2_11SymmetryMap_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_14softwrap_core2_11SymmetryMap_7__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_14softwrap_core2_11SymmetryMap_6__dealloc__(((struct __pyx_obj_14softwrap_core2_SymmetryMap *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_14softwrap_core2_11SymmetryMap_6__dealloc__(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "core/core2.pyx":1373 + * + * def __dealloc__(self): + * fraeee(self.symm_map) # <<<<<<<<<<<<<< + * + * + */ + +# line 1373 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->symm_map); + + /* "core/core2.pyx":1372 + * self.engine.tmp_verts, self.engine.m.verts = self.engine.m.verts, self.engine.tmp_verts + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.symm_map) + * + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "core/core2.pyx":1316 + * cdef int* symm_map + * cdef SpringEngine engine + * cdef readonly float[3] error # <<<<<<<<<<<<<< + * + * def __cinit__(self, SpringEngine engine): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_5error_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_5error_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_11SymmetryMap_5error___get__(((struct __pyx_obj_14softwrap_core2_SymmetryMap *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_5error___get__(struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_carray_to_py_float(__pyx_v_self->error, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1316, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.error.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_11SymmetryMap_8__reduce_cython__(((struct __pyx_obj_14softwrap_core2_SymmetryMap *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_11SymmetryMap_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_11SymmetryMap_10__setstate_cython__(((struct __pyx_obj_14softwrap_core2_SymmetryMap *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_11SymmetryMap_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SymmetryMap.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1386 + * cdef int n_verts + * + * def __init__(self, Mesh m, BVH bvh=None): # <<<<<<<<<<<<<< + * self.m = m + * self.n_verts = m.n_verts + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_12SpringEngine_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_14softwrap_core2_12SpringEngine_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_m = 0; + struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_bvh = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,&__pyx_n_s_bvh,0}; + PyObject* values[2] = {0,0}; + values[1] = (PyObject *)((struct __pyx_obj_14softwrap_core2_BVH *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bvh); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1386, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_m = ((struct __pyx_obj_14softwrap_core2_Mesh *)values[0]); + __pyx_v_bvh = ((struct __pyx_obj_14softwrap_core2_BVH *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1386, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_14softwrap_core2_Mesh, 1, "m", 0))) __PYX_ERR(0, 1386, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bvh), __pyx_ptype_14softwrap_core2_BVH, 1, "bvh", 0))) __PYX_ERR(0, 1386, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine___init__(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), __pyx_v_m, __pyx_v_bvh); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_12SpringEngine___init__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, struct __pyx_obj_14softwrap_core2_Mesh *__pyx_v_m, struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_bvh) { + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + void *__pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "core/core2.pyx":1387 + * + * def __init__(self, Mesh m, BVH bvh=None): + * self.m = m # <<<<<<<<<<<<<< + * self.n_verts = m.n_verts + * self.snap_count = 0 + */ + +# line 1387 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_m)); + +# line 1387 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_m)); + +# line 1387 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->m); + +# line 1387 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->m)); + +# line 1387 "core/core2.pyx" + __pyx_v_self->m = __pyx_v_m; + + /* "core/core2.pyx":1388 + * def __init__(self, Mesh m, BVH bvh=None): + * self.m = m + * self.n_verts = m.n_verts # <<<<<<<<<<<<<< + * self.snap_count = 0 + * self.prev_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + */ + +# line 1388 "core/core2.pyx" + __pyx_t_1 = __pyx_v_m->n_verts; + +# line 1388 "core/core2.pyx" + __pyx_v_self->n_verts = __pyx_t_1; + + /* "core/core2.pyx":1389 + * self.m = m + * self.n_verts = m.n_verts + * self.snap_count = 0 # <<<<<<<<<<<<<< + * self.prev_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + * self.tmp_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + */ + +# line 1389 "core/core2.pyx" + __pyx_v_self->snap_count = 0; + + /* "core/core2.pyx":1390 + * self.n_verts = m.n_verts + * self.snap_count = 0 + * self.prev_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) # <<<<<<<<<<<<<< + * self.tmp_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + * self.bvh_closest_indexes = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + */ + +# line 1390 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_maelloc(((sizeof(vec3)) * __pyx_v_self->n_verts), __LINE__); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 1390, __pyx_L1_error) + +# line 1390 "core/core2.pyx" + __pyx_v_self->prev_verts = ((vec3 *)__pyx_t_2); + + /* "core/core2.pyx":1391 + * self.snap_count = 0 + * self.prev_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + * self.tmp_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) # <<<<<<<<<<<<<< + * self.bvh_closest_indexes = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + * cdef int i + */ + +# line 1391 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_maelloc(((sizeof(vec3)) * __pyx_v_self->n_verts), __LINE__); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 1391, __pyx_L1_error) + +# line 1391 "core/core2.pyx" + __pyx_v_self->tmp_verts = ((vec3 *)__pyx_t_2); + + /* "core/core2.pyx":1392 + * self.prev_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + * self.tmp_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + * self.bvh_closest_indexes = maelloc(sizeof(vec3) * self.n_verts, __LINE__) # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.n_verts): + */ + +# line 1392 "core/core2.pyx" + __pyx_t_2 = __pyx_f_14softwrap_core2_maelloc(((sizeof(vec3)) * __pyx_v_self->n_verts), __LINE__); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 1392, __pyx_L1_error) + +# line 1392 "core/core2.pyx" + __pyx_v_self->bvh_closest_indexes = ((int *)__pyx_t_2); + + /* "core/core2.pyx":1394 + * self.bvh_closest_indexes = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + * cdef int i + * for i in range(self.n_verts): # <<<<<<<<<<<<<< + * self.prev_verts[i] = self.m.verts[i] + * + */ + +# line 1394 "core/core2.pyx" + __pyx_t_1 = __pyx_v_self->n_verts; + +# line 1394 "core/core2.pyx" + __pyx_t_3 = __pyx_t_1; + +# line 1394 "core/core2.pyx" + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + +# line 1394 "core/core2.pyx" + __pyx_v_i = __pyx_t_4; + + /* "core/core2.pyx":1395 + * cdef int i + * for i in range(self.n_verts): + * self.prev_verts[i] = self.m.verts[i] # <<<<<<<<<<<<<< + * + * self.set_bvh(bvh) + */ + +# line 1395 "core/core2.pyx" + (__pyx_v_self->prev_verts[__pyx_v_i]) = (__pyx_v_self->m->verts[__pyx_v_i]); + +# line 1395 "core/core2.pyx" + } + + /* "core/core2.pyx":1397 + * self.prev_verts[i] = self.m.verts[i] + * + * self.set_bvh(bvh) # <<<<<<<<<<<<<< + * + * cpdef void set_bvh(self, BVH bvh): + */ + +# line 1397 "core/core2.pyx" + ((struct __pyx_vtabstruct_14softwrap_core2_SpringEngine *)__pyx_v_self->__pyx_vtab)->set_bvh(__pyx_v_self, __pyx_v_bvh, 0); + + /* "core/core2.pyx":1386 + * cdef int n_verts + * + * def __init__(self, Mesh m, BVH bvh=None): # <<<<<<<<<<<<<< + * self.m = m + * self.n_verts = m.n_verts + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1399 + * self.set_bvh(bvh) + * + * cpdef void set_bvh(self, BVH bvh): # <<<<<<<<<<<<<< + * self.bvh = bvh + * + */ + +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_3set_bvh(PyObject *__pyx_v_self, PyObject *__pyx_v_bvh); /*proto*/ +static void __pyx_f_14softwrap_core2_12SpringEngine_set_bvh(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_bvh, int __pyx_skip_dispatch) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_bvh", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_bvh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_12SpringEngine_3set_bvh)) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_bvh)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_bvh)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1400 + * + * cpdef void set_bvh(self, BVH bvh): + * self.bvh = bvh # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1400 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_bvh)); + +# line 1400 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_bvh)); + +# line 1400 "core/core2.pyx" + __Pyx_GOTREF(__pyx_v_self->bvh); + +# line 1400 "core/core2.pyx" + __Pyx_DECREF(((PyObject *)__pyx_v_self->bvh)); + +# line 1400 "core/core2.pyx" + __pyx_v_self->bvh = __pyx_v_bvh; + + /* "core/core2.pyx":1403 + * + * cdef int i + * if bvh: # <<<<<<<<<<<<<< + * with nogil: + * for i in prange(self.n_verts): + */ + +# line 1403 "core/core2.pyx" + __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_bvh)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1403, __pyx_L1_error) + +# line 1403 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1404 + * cdef int i + * if bvh: + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * self.bvh_closest_indexes[i] = -1 + */ + +# line 1404 "core/core2.pyx" + { + +# line 1404 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1404 "core/core2.pyx" + PyThreadState *_save; + +# line 1404 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1404 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1404 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1405 + * if bvh: + * with nogil: + * for i in prange(self.n_verts): # <<<<<<<<<<<<<< + * self.bvh_closest_indexes[i] = -1 + * + */ + +# line 1405 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->n_verts; + +# line 1405 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1405 "core/core2.pyx" + { + +# line 1405 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1405 "core/core2.pyx" + #undef likely + +# line 1405 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1405 "core/core2.pyx" + #endif + +# line 1405 "core/core2.pyx" + __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; + +# line 1405 "core/core2.pyx" + if (__pyx_t_8 > 0) + +# line 1405 "core/core2.pyx" + { + +# line 1405 "core/core2.pyx" + #ifdef _OPENMP + +# line 1405 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); + + /* "core/core2.pyx":1406 + * with nogil: + * for i in prange(self.n_verts): + * self.bvh_closest_indexes[i] = -1 # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + +# line 1406 "core/core2.pyx" + (__pyx_v_self->bvh_closest_indexes[__pyx_v_i]) = -1; + +# line 1406 "core/core2.pyx" + } + +# line 1406 "core/core2.pyx" + } + +# line 1406 "core/core2.pyx" + } + +# line 1406 "core/core2.pyx" + } + +# line 1406 "core/core2.pyx" + } + +# line 1406 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1406 "core/core2.pyx" + #undef likely + +# line 1406 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1406 "core/core2.pyx" + #endif + +# line 1406 "core/core2.pyx" + } + + /* "core/core2.pyx":1404 + * cdef int i + * if bvh: + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * self.bvh_closest_indexes[i] = -1 + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":1403 + * + * cdef int i + * if bvh: # <<<<<<<<<<<<<< + * with nogil: + * for i in prange(self.n_verts): + */ + +# line 1403 "core/core2.pyx" + } + + /* "core/core2.pyx":1399 + * self.set_bvh(bvh) + * + * cpdef void set_bvh(self, BVH bvh): # <<<<<<<<<<<<<< + * self.bvh = bvh + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("softwrap_core2.SpringEngine.set_bvh", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_3set_bvh(PyObject *__pyx_v_self, PyObject *__pyx_v_bvh); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_3set_bvh(PyObject *__pyx_v_self, PyObject *__pyx_v_bvh) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_bvh (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bvh), __pyx_ptype_14softwrap_core2_BVH, 1, "bvh", 0))) __PYX_ERR(0, 1399, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_2set_bvh(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((struct __pyx_obj_14softwrap_core2_BVH *)__pyx_v_bvh)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_2set_bvh(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, struct __pyx_obj_14softwrap_core2_BVH *__pyx_v_bvh) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_bvh", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_12SpringEngine_set_bvh(__pyx_v_self, __pyx_v_bvh, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.set_bvh", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1408 + * self.bvh_closest_indexes[i] = -1 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.prev_verts) + * fraeee(self.tmp_verts) + */ + +/* Python wrapper */ +static void __pyx_pw_14softwrap_core2_12SpringEngine_5__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_14softwrap_core2_12SpringEngine_5__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_14softwrap_core2_12SpringEngine_4__dealloc__(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_14softwrap_core2_12SpringEngine_4__dealloc__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "core/core2.pyx":1409 + * + * def __dealloc__(self): + * fraeee(self.prev_verts) # <<<<<<<<<<<<<< + * fraeee(self.tmp_verts) + * fraeee(self.bvh_closest_indexes) + */ + +# line 1409 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->prev_verts); + + /* "core/core2.pyx":1410 + * def __dealloc__(self): + * fraeee(self.prev_verts) + * fraeee(self.tmp_verts) # <<<<<<<<<<<<<< + * fraeee(self.bvh_closest_indexes) + * + */ + +# line 1410 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->tmp_verts); + + /* "core/core2.pyx":1411 + * fraeee(self.prev_verts) + * fraeee(self.tmp_verts) + * fraeee(self.bvh_closest_indexes) # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + +# line 1411 "core/core2.pyx" + __pyx_f_14softwrap_core2_fraeee(__pyx_v_self->bvh_closest_indexes); + + /* "core/core2.pyx":1408 + * self.bvh_closest_indexes[i] = -1 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * fraeee(self.prev_verts) + * fraeee(self.tmp_verts) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "core/core2.pyx":1413 + * fraeee(self.bvh_closest_indexes) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.n_verts * 3 + * + */ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_14softwrap_core2_12SpringEngine_7__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_14softwrap_core2_12SpringEngine_7__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_6__len__(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_14softwrap_core2_12SpringEngine_6__len__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "core/core2.pyx":1414 + * + * def __len__(self): + * return self.n_verts * 3 # <<<<<<<<<<<<<< + * + * def __getitem__(self, int key): + */ + +# line 1414 "core/core2.pyx" + __pyx_r = (__pyx_v_self->n_verts * 3); + +# line 1414 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1413 + * fraeee(self.bvh_closest_indexes) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.n_verts * 3 + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1416 + * return self.n_verts * 3 + * + * def __getitem__(self, int key): # <<<<<<<<<<<<<< + * return self.m.verts[key // 3].v[key % 3] + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_key); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_key) { + int __pyx_v_key; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + assert(__pyx_arg_key); { + __pyx_v_key = __Pyx_PyInt_As_int(__pyx_arg_key); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1416, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_8__getitem__(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((int)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_8__getitem__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, int __pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "core/core2.pyx":1417 + * + * def __getitem__(self, int key): + * return self.m.verts[key // 3].v[key % 3] # <<<<<<<<<<<<<< + * + * def __setitem__(self, int key, float v): + */ + +# line 1417 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 1417 "core/core2.pyx" + __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_self->m->verts[(__pyx_v_key / 3)]).v[(__pyx_v_key % 3)])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1417, __pyx_L1_error) + +# line 1417 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1417 "core/core2.pyx" + __pyx_r = __pyx_t_1; + +# line 1417 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 1417 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1416 + * return self.n_verts * 3 + * + * def __getitem__(self, int key): # <<<<<<<<<<<<<< + * return self.m.verts[key // 3].v[key % 3] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1419 + * return self.m.verts[key // 3].v[key % 3] + * + * def __setitem__(self, int key, float v): # <<<<<<<<<<<<<< + * self.m.verts[key // 3].v[key % 3] = v + * self.prev_verts[key // 3].v[key % 3] = v + */ + +/* Python wrapper */ +static int __pyx_pw_14softwrap_core2_12SpringEngine_11__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_key, PyObject *__pyx_arg_v); /*proto*/ +static int __pyx_pw_14softwrap_core2_12SpringEngine_11__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_key, PyObject *__pyx_arg_v) { + int __pyx_v_key; + float __pyx_v_v; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + assert(__pyx_arg_key); { + __pyx_v_key = __Pyx_PyInt_As_int(__pyx_arg_key); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1419, __pyx_L3_error) + } + assert(__pyx_arg_v); { + __pyx_v_v = __pyx_PyFloat_AsFloat(__pyx_arg_v); if (unlikely((__pyx_v_v == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1419, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_10__setitem__(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((int)__pyx_v_key), ((float)__pyx_v_v)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_14softwrap_core2_12SpringEngine_10__setitem__(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, int __pyx_v_key, float __pyx_v_v) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "core/core2.pyx":1420 + * + * def __setitem__(self, int key, float v): + * self.m.verts[key // 3].v[key % 3] = v # <<<<<<<<<<<<<< + * self.prev_verts[key // 3].v[key % 3] = v + * + */ + +# line 1420 "core/core2.pyx" + ((__pyx_v_self->m->verts[(__pyx_v_key / 3)]).v[(__pyx_v_key % 3)]) = __pyx_v_v; + + /* "core/core2.pyx":1421 + * def __setitem__(self, int key, float v): + * self.m.verts[key // 3].v[key % 3] = v + * self.prev_verts[key // 3].v[key % 3] = v # <<<<<<<<<<<<<< + * + * def from_list(self, list items): + */ + +# line 1421 "core/core2.pyx" + ((__pyx_v_self->prev_verts[(__pyx_v_key / 3)]).v[(__pyx_v_key % 3)]) = __pyx_v_v; + + /* "core/core2.pyx":1419 + * return self.m.verts[key // 3].v[key % 3] + * + * def __setitem__(self, int key, float v): # <<<<<<<<<<<<<< + * self.m.verts[key // 3].v[key % 3] = v + * self.prev_verts[key // 3].v[key % 3] = v + */ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1423 + * self.prev_verts[key // 3].v[key % 3] = v + * + * def from_list(self, list items): # <<<<<<<<<<<<<< + * if not len(items) >= self.n_verts * 3: + * raise ValueError('list too small') + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_13from_list(PyObject *__pyx_v_self, PyObject *__pyx_v_items); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_13from_list(PyObject *__pyx_v_self, PyObject *__pyx_v_items) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_list (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_items), (&PyList_Type), 1, "items", 1))) __PYX_ERR(0, 1423, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_12from_list(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((PyObject*)__pyx_v_items)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_12from_list(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_items) { + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + long __pyx_t_4; + long __pyx_t_5; + int __pyx_t_6; + float __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_list", 0); + + /* "core/core2.pyx":1424 + * + * def from_list(self, list items): + * if not len(items) >= self.n_verts * 3: # <<<<<<<<<<<<<< + * raise ValueError('list too small') + * + */ + +# line 1424 "core/core2.pyx" + if (unlikely(__pyx_v_items == Py_None)) { + +# line 1424 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1424 "core/core2.pyx" + __PYX_ERR(0, 1424, __pyx_L1_error) + +# line 1424 "core/core2.pyx" + } + +# line 1424 "core/core2.pyx" + __pyx_t_1 = PyList_GET_SIZE(__pyx_v_items); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1424, __pyx_L1_error) + +# line 1424 "core/core2.pyx" + __pyx_t_2 = ((!((__pyx_t_1 >= (__pyx_v_self->n_verts * 3)) != 0)) != 0); + +# line 1424 "core/core2.pyx" + if (unlikely(__pyx_t_2)) { + + /* "core/core2.pyx":1425 + * def from_list(self, list items): + * if not len(items) >= self.n_verts * 3: + * raise ValueError('list too small') # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1425 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1425, __pyx_L1_error) + +# line 1425 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 1425 "core/core2.pyx" + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + +# line 1425 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 1425 "core/core2.pyx" + __PYX_ERR(0, 1425, __pyx_L1_error) + + /* "core/core2.pyx":1424 + * + * def from_list(self, list items): + * if not len(items) >= self.n_verts * 3: # <<<<<<<<<<<<<< + * raise ValueError('list too small') + * + */ + +# line 1424 "core/core2.pyx" + } + + /* "core/core2.pyx":1428 + * + * cdef int i + * for i in range(self.n_verts * 3): # <<<<<<<<<<<<<< + * self.m.verts[i // 3].v[i % 3] = items[i] + * self.prev_verts[i // 3].v[i % 3] = items[i] + */ + +# line 1428 "core/core2.pyx" + __pyx_t_4 = (__pyx_v_self->n_verts * 3); + +# line 1428 "core/core2.pyx" + __pyx_t_5 = __pyx_t_4; + +# line 1428 "core/core2.pyx" + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + +# line 1428 "core/core2.pyx" + __pyx_v_i = __pyx_t_6; + + /* "core/core2.pyx":1429 + * cdef int i + * for i in range(self.n_verts * 3): + * self.m.verts[i // 3].v[i % 3] = items[i] # <<<<<<<<<<<<<< + * self.prev_verts[i // 3].v[i % 3] = items[i] + * + */ + +# line 1429 "core/core2.pyx" + if (unlikely(__pyx_v_items == Py_None)) { + +# line 1429 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1429 "core/core2.pyx" + __PYX_ERR(0, 1429, __pyx_L1_error) + +# line 1429 "core/core2.pyx" + } + +# line 1429 "core/core2.pyx" + __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_items, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1429, __pyx_L1_error) + +# line 1429 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 1429 "core/core2.pyx" + __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1429, __pyx_L1_error) + +# line 1429 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 1429 "core/core2.pyx" + ((__pyx_v_self->m->verts[(__pyx_v_i / 3)]).v[(__pyx_v_i % 3)]) = __pyx_t_7; + + /* "core/core2.pyx":1430 + * for i in range(self.n_verts * 3): + * self.m.verts[i // 3].v[i % 3] = items[i] + * self.prev_verts[i // 3].v[i % 3] = items[i] # <<<<<<<<<<<<<< + * + * def set_verts(self, list indexes, list locations): + */ + +# line 1430 "core/core2.pyx" + if (unlikely(__pyx_v_items == Py_None)) { + +# line 1430 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1430 "core/core2.pyx" + __PYX_ERR(0, 1430, __pyx_L1_error) + +# line 1430 "core/core2.pyx" + } + +# line 1430 "core/core2.pyx" + __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_items, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1430, __pyx_L1_error) + +# line 1430 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 1430 "core/core2.pyx" + __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1430, __pyx_L1_error) + +# line 1430 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + +# line 1430 "core/core2.pyx" + ((__pyx_v_self->prev_verts[(__pyx_v_i / 3)]).v[(__pyx_v_i % 3)]) = __pyx_t_7; + +# line 1430 "core/core2.pyx" + } + + /* "core/core2.pyx":1423 + * self.prev_verts[key // 3].v[key % 3] = v + * + * def from_list(self, list items): # <<<<<<<<<<<<<< + * if not len(items) >= self.n_verts * 3: + * raise ValueError('list too small') + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.from_list", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1432 + * self.prev_verts[i // 3].v[i % 3] = items[i] + * + * def set_verts(self, list indexes, list locations): # <<<<<<<<<<<<<< + * cdef int i, index + * cdef float x, y, z + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_15set_verts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_15set_verts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_indexes = 0; + PyObject *__pyx_v_locations = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_verts (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indexes,&__pyx_n_s_locations,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_indexes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_locations)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_verts", 1, 2, 2, 1); __PYX_ERR(0, 1432, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_verts") < 0)) __PYX_ERR(0, 1432, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_indexes = ((PyObject*)values[0]); + __pyx_v_locations = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_verts", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1432, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.set_verts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexes), (&PyList_Type), 1, "indexes", 1))) __PYX_ERR(0, 1432, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_locations), (&PyList_Type), 1, "locations", 1))) __PYX_ERR(0, 1432, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_14set_verts(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), __pyx_v_indexes, __pyx_v_locations); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_14set_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_indexes, PyObject *__pyx_v_locations) { + int __pyx_v_i; + int __pyx_v_index; + float __pyx_v_x; + float __pyx_v_y; + float __pyx_v_z; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + float __pyx_t_12; + float __pyx_t_13; + float __pyx_t_14; + vec3 __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_verts", 0); + + /* "core/core2.pyx":1435 + * cdef int i, index + * cdef float x, y, z + * if not len(indexes) == len(locations): # <<<<<<<<<<<<<< + * raise ValueError('indexes array is not the same size as locations array') + * + */ + +# line 1435 "core/core2.pyx" + if (unlikely(__pyx_v_indexes == Py_None)) { + +# line 1435 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1435 "core/core2.pyx" + __PYX_ERR(0, 1435, __pyx_L1_error) + +# line 1435 "core/core2.pyx" + } + +# line 1435 "core/core2.pyx" + __pyx_t_1 = PyList_GET_SIZE(__pyx_v_indexes); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1435, __pyx_L1_error) + +# line 1435 "core/core2.pyx" + if (unlikely(__pyx_v_locations == Py_None)) { + +# line 1435 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1435 "core/core2.pyx" + __PYX_ERR(0, 1435, __pyx_L1_error) + +# line 1435 "core/core2.pyx" + } + +# line 1435 "core/core2.pyx" + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_locations); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1435, __pyx_L1_error) + +# line 1435 "core/core2.pyx" + __pyx_t_3 = ((!((__pyx_t_1 == __pyx_t_2) != 0)) != 0); + +# line 1435 "core/core2.pyx" + if (unlikely(__pyx_t_3)) { + + /* "core/core2.pyx":1436 + * cdef float x, y, z + * if not len(indexes) == len(locations): + * raise ValueError('indexes array is not the same size as locations array') # <<<<<<<<<<<<<< + * + * for i in range(len(indexes)): + */ + +# line 1436 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1436, __pyx_L1_error) + +# line 1436 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1436 "core/core2.pyx" + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + +# line 1436 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1436 "core/core2.pyx" + __PYX_ERR(0, 1436, __pyx_L1_error) + + /* "core/core2.pyx":1435 + * cdef int i, index + * cdef float x, y, z + * if not len(indexes) == len(locations): # <<<<<<<<<<<<<< + * raise ValueError('indexes array is not the same size as locations array') + * + */ + +# line 1435 "core/core2.pyx" + } + + /* "core/core2.pyx":1438 + * raise ValueError('indexes array is not the same size as locations array') + * + * for i in range(len(indexes)): # <<<<<<<<<<<<<< + * index = indexes[i] + * x, y, z = locations[i] + */ + +# line 1438 "core/core2.pyx" + if (unlikely(__pyx_v_indexes == Py_None)) { + +# line 1438 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1438 "core/core2.pyx" + __PYX_ERR(0, 1438, __pyx_L1_error) + +# line 1438 "core/core2.pyx" + } + +# line 1438 "core/core2.pyx" + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_indexes); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1438, __pyx_L1_error) + +# line 1438 "core/core2.pyx" + __pyx_t_1 = __pyx_t_2; + +# line 1438 "core/core2.pyx" + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_1; __pyx_t_5+=1) { + +# line 1438 "core/core2.pyx" + __pyx_v_i = __pyx_t_5; + + /* "core/core2.pyx":1439 + * + * for i in range(len(indexes)): + * index = indexes[i] # <<<<<<<<<<<<<< + * x, y, z = locations[i] + * self.prev_verts[index] = self.m.verts[index] = vec3(x, y, z) + */ + +# line 1439 "core/core2.pyx" + if (unlikely(__pyx_v_indexes == Py_None)) { + +# line 1439 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1439 "core/core2.pyx" + __PYX_ERR(0, 1439, __pyx_L1_error) + +# line 1439 "core/core2.pyx" + } + +# line 1439 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_indexes, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1439, __pyx_L1_error) + +# line 1439 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1439 "core/core2.pyx" + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1439, __pyx_L1_error) + +# line 1439 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1439 "core/core2.pyx" + __pyx_v_index = __pyx_t_6; + + /* "core/core2.pyx":1440 + * for i in range(len(indexes)): + * index = indexes[i] + * x, y, z = locations[i] # <<<<<<<<<<<<<< + * self.prev_verts[index] = self.m.verts[index] = vec3(x, y, z) + * + */ + +# line 1440 "core/core2.pyx" + if (unlikely(__pyx_v_locations == Py_None)) { + +# line 1440 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1440 "core/core2.pyx" + __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + } + +# line 1440 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_locations, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1440 "core/core2.pyx" + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + +# line 1440 "core/core2.pyx" + PyObject* sequence = __pyx_t_4; + +# line 1440 "core/core2.pyx" + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + +# line 1440 "core/core2.pyx" + if (unlikely(size != 3)) { + +# line 1440 "core/core2.pyx" + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + +# line 1440 "core/core2.pyx" + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + +# line 1440 "core/core2.pyx" + __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + } + +# line 1440 "core/core2.pyx" + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + +# line 1440 "core/core2.pyx" + if (likely(PyTuple_CheckExact(sequence))) { + +# line 1440 "core/core2.pyx" + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); + +# line 1440 "core/core2.pyx" + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + +# line 1440 "core/core2.pyx" + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); + +# line 1440 "core/core2.pyx" + } else { + +# line 1440 "core/core2.pyx" + __pyx_t_7 = PyList_GET_ITEM(sequence, 0); + +# line 1440 "core/core2.pyx" + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + +# line 1440 "core/core2.pyx" + __pyx_t_9 = PyList_GET_ITEM(sequence, 2); + +# line 1440 "core/core2.pyx" + } + +# line 1440 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_7); + +# line 1440 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_8); + +# line 1440 "core/core2.pyx" + __Pyx_INCREF(__pyx_t_9); + +# line 1440 "core/core2.pyx" + #else + +# line 1440 "core/core2.pyx" + __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 1440 "core/core2.pyx" + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 1440 "core/core2.pyx" + __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 1440 "core/core2.pyx" + #endif + +# line 1440 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1440 "core/core2.pyx" + } else { + +# line 1440 "core/core2.pyx" + Py_ssize_t index = -1; + +# line 1440 "core/core2.pyx" + __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_10); + +# line 1440 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1440 "core/core2.pyx" + __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; + +# line 1440 "core/core2.pyx" + index = 0; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + +# line 1440 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_7); + +# line 1440 "core/core2.pyx" + index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed; + +# line 1440 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_8); + +# line 1440 "core/core2.pyx" + index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed; + +# line 1440 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_9); + +# line 1440 "core/core2.pyx" + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __pyx_t_11 = NULL; + +# line 1440 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + +# line 1440 "core/core2.pyx" + goto __pyx_L7_unpacking_done; + +# line 1440 "core/core2.pyx" + __pyx_L6_unpacking_failed:; + +# line 1440 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + +# line 1440 "core/core2.pyx" + __pyx_t_11 = NULL; + +# line 1440 "core/core2.pyx" + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + +# line 1440 "core/core2.pyx" + __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __pyx_L7_unpacking_done:; + +# line 1440 "core/core2.pyx" + } + +# line 1440 "core/core2.pyx" + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + +# line 1440 "core/core2.pyx" + __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_t_8); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + +# line 1440 "core/core2.pyx" + __pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_t_9); if (unlikely((__pyx_t_14 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1440, __pyx_L1_error) + +# line 1440 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + +# line 1440 "core/core2.pyx" + __pyx_v_x = __pyx_t_12; + +# line 1440 "core/core2.pyx" + __pyx_v_y = __pyx_t_13; + +# line 1440 "core/core2.pyx" + __pyx_v_z = __pyx_t_14; + + /* "core/core2.pyx":1441 + * index = indexes[i] + * x, y, z = locations[i] + * self.prev_verts[index] = self.m.verts[index] = vec3(x, y, z) # <<<<<<<<<<<<<< + * + * def get_verts(self, list indexes): + */ + +# line 1441 "core/core2.pyx" + __pyx_t_15 = vec3(__pyx_v_x, __pyx_v_y, __pyx_v_z); + +# line 1441 "core/core2.pyx" + (__pyx_v_self->prev_verts[__pyx_v_index]) = __pyx_t_15; + +# line 1441 "core/core2.pyx" + (__pyx_v_self->m->verts[__pyx_v_index]) = __pyx_t_15; + +# line 1441 "core/core2.pyx" + } + + /* "core/core2.pyx":1432 + * self.prev_verts[i // 3].v[i % 3] = items[i] + * + * def set_verts(self, list indexes, list locations): # <<<<<<<<<<<<<< + * cdef int i, index + * cdef float x, y, z + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.set_verts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1443 + * self.prev_verts[index] = self.m.verts[index] = vec3(x, y, z) + * + * def get_verts(self, list indexes): # <<<<<<<<<<<<<< + * cdef int i, index + * cdef list ret = [] + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_17get_verts(PyObject *__pyx_v_self, PyObject *__pyx_v_indexes); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_17get_verts(PyObject *__pyx_v_self, PyObject *__pyx_v_indexes) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_verts (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexes), (&PyList_Type), 1, "indexes", 1))) __PYX_ERR(0, 1443, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_16get_verts(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((PyObject*)__pyx_v_indexes)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_16get_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_indexes) { + int __pyx_v_i; + int __pyx_v_index; + PyObject *__pyx_v_ret = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_verts", 0); + + /* "core/core2.pyx":1445 + * def get_verts(self, list indexes): + * cdef int i, index + * cdef list ret = [] # <<<<<<<<<<<<<< + * for i in range(len(indexes)): + * index = indexes[i] + */ + +# line 1445 "core/core2.pyx" + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1445, __pyx_L1_error) + +# line 1445 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1445 "core/core2.pyx" + __pyx_v_ret = ((PyObject*)__pyx_t_1); + +# line 1445 "core/core2.pyx" + __pyx_t_1 = 0; + + /* "core/core2.pyx":1446 + * cdef int i, index + * cdef list ret = [] + * for i in range(len(indexes)): # <<<<<<<<<<<<<< + * index = indexes[i] + * if index < 0 or index >= self.n_verts: + */ + +# line 1446 "core/core2.pyx" + if (unlikely(__pyx_v_indexes == Py_None)) { + +# line 1446 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1446 "core/core2.pyx" + __PYX_ERR(0, 1446, __pyx_L1_error) + +# line 1446 "core/core2.pyx" + } + +# line 1446 "core/core2.pyx" + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_indexes); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1446, __pyx_L1_error) + +# line 1446 "core/core2.pyx" + __pyx_t_3 = __pyx_t_2; + +# line 1446 "core/core2.pyx" + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + +# line 1446 "core/core2.pyx" + __pyx_v_i = __pyx_t_4; + + /* "core/core2.pyx":1447 + * cdef list ret = [] + * for i in range(len(indexes)): + * index = indexes[i] # <<<<<<<<<<<<<< + * if index < 0 or index >= self.n_verts: + * raise IndexError + */ + +# line 1447 "core/core2.pyx" + if (unlikely(__pyx_v_indexes == Py_None)) { + +# line 1447 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1447 "core/core2.pyx" + __PYX_ERR(0, 1447, __pyx_L1_error) + +# line 1447 "core/core2.pyx" + } + +# line 1447 "core/core2.pyx" + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_indexes, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1447, __pyx_L1_error) + +# line 1447 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1447 "core/core2.pyx" + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1447, __pyx_L1_error) + +# line 1447 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1447 "core/core2.pyx" + __pyx_v_index = __pyx_t_5; + + /* "core/core2.pyx":1448 + * for i in range(len(indexes)): + * index = indexes[i] + * if index < 0 or index >= self.n_verts: # <<<<<<<<<<<<<< + * raise IndexError + * ret.append(self.m.verts[index].v) + */ + +# line 1448 "core/core2.pyx" + __pyx_t_7 = ((__pyx_v_index < 0) != 0); + +# line 1448 "core/core2.pyx" + if (!__pyx_t_7) { + +# line 1448 "core/core2.pyx" + } else { + +# line 1448 "core/core2.pyx" + __pyx_t_6 = __pyx_t_7; + +# line 1448 "core/core2.pyx" + goto __pyx_L6_bool_binop_done; + +# line 1448 "core/core2.pyx" + } + +# line 1448 "core/core2.pyx" + __pyx_t_7 = ((__pyx_v_index >= __pyx_v_self->n_verts) != 0); + +# line 1448 "core/core2.pyx" + __pyx_t_6 = __pyx_t_7; + +# line 1448 "core/core2.pyx" + __pyx_L6_bool_binop_done:; + +# line 1448 "core/core2.pyx" + if (unlikely(__pyx_t_6)) { + + /* "core/core2.pyx":1449 + * index = indexes[i] + * if index < 0 or index >= self.n_verts: + * raise IndexError # <<<<<<<<<<<<<< + * ret.append(self.m.verts[index].v) + * return ret + */ + +# line 1449 "core/core2.pyx" + __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); + +# line 1449 "core/core2.pyx" + __PYX_ERR(0, 1449, __pyx_L1_error) + + /* "core/core2.pyx":1448 + * for i in range(len(indexes)): + * index = indexes[i] + * if index < 0 or index >= self.n_verts: # <<<<<<<<<<<<<< + * raise IndexError + * ret.append(self.m.verts[index].v) + */ + +# line 1448 "core/core2.pyx" + } + + /* "core/core2.pyx":1450 + * if index < 0 or index >= self.n_verts: + * raise IndexError + * ret.append(self.m.verts[index].v) # <<<<<<<<<<<<<< + * return ret + * + */ + +# line 1450 "core/core2.pyx" + __pyx_t_1 = __Pyx_carray_to_py_float((__pyx_v_self->m->verts[__pyx_v_index]).v, 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1450, __pyx_L1_error) + +# line 1450 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1450 "core/core2.pyx" + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1450, __pyx_L1_error) + +# line 1450 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1450 "core/core2.pyx" + } + + /* "core/core2.pyx":1451 + * raise IndexError + * ret.append(self.m.verts[index].v) + * return ret # <<<<<<<<<<<<<< + * + * def move_verts(self, list indexes, float x, float y, float z): + */ + +# line 1451 "core/core2.pyx" + __Pyx_XDECREF(__pyx_r); + +# line 1451 "core/core2.pyx" + __Pyx_INCREF(__pyx_v_ret); + +# line 1451 "core/core2.pyx" + __pyx_r = __pyx_v_ret; + +# line 1451 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1443 + * self.prev_verts[index] = self.m.verts[index] = vec3(x, y, z) + * + * def get_verts(self, list indexes): # <<<<<<<<<<<<<< + * cdef int i, index + * cdef list ret = [] + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.get_verts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1453 + * return ret + * + * def move_verts(self, list indexes, float x, float y, float z): # <<<<<<<<<<<<<< + * cdef vec3 delta = vec3(x, y, z) + * cdef int i, index + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_19move_verts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_19move_verts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_indexes = 0; + float __pyx_v_x; + float __pyx_v_y; + float __pyx_v_z; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("move_verts (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indexes,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,0}; + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_indexes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("move_verts", 1, 4, 4, 1); __PYX_ERR(0, 1453, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("move_verts", 1, 4, 4, 2); __PYX_ERR(0, 1453, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("move_verts", 1, 4, 4, 3); __PYX_ERR(0, 1453, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "move_verts") < 0)) __PYX_ERR(0, 1453, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_indexes = ((PyObject*)values[0]); + __pyx_v_x = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1453, __pyx_L3_error) + __pyx_v_y = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_y == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1453, __pyx_L3_error) + __pyx_v_z = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_z == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1453, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("move_verts", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1453, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.move_verts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexes), (&PyList_Type), 1, "indexes", 1))) __PYX_ERR(0, 1453, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_18move_verts(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), __pyx_v_indexes, __pyx_v_x, __pyx_v_y, __pyx_v_z); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_18move_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_indexes, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z) { + vec3 __pyx_v_delta; + int __pyx_v_i; + int __pyx_v_index; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("move_verts", 0); + + /* "core/core2.pyx":1454 + * + * def move_verts(self, list indexes, float x, float y, float z): + * cdef vec3 delta = vec3(x, y, z) # <<<<<<<<<<<<<< + * cdef int i, index + * for i in range(len(indexes)): + */ + +# line 1454 "core/core2.pyx" + __pyx_v_delta = vec3(__pyx_v_x, __pyx_v_y, __pyx_v_z); + + /* "core/core2.pyx":1456 + * cdef vec3 delta = vec3(x, y, z) + * cdef int i, index + * for i in range(len(indexes)): # <<<<<<<<<<<<<< + * index = indexes[i] + * if index < 0 or index >= self.n_verts: + */ + +# line 1456 "core/core2.pyx" + if (unlikely(__pyx_v_indexes == Py_None)) { + +# line 1456 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + +# line 1456 "core/core2.pyx" + __PYX_ERR(0, 1456, __pyx_L1_error) + +# line 1456 "core/core2.pyx" + } + +# line 1456 "core/core2.pyx" + __pyx_t_1 = PyList_GET_SIZE(__pyx_v_indexes); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1456, __pyx_L1_error) + +# line 1456 "core/core2.pyx" + __pyx_t_2 = __pyx_t_1; + +# line 1456 "core/core2.pyx" + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + +# line 1456 "core/core2.pyx" + __pyx_v_i = __pyx_t_3; + + /* "core/core2.pyx":1457 + * cdef int i, index + * for i in range(len(indexes)): + * index = indexes[i] # <<<<<<<<<<<<<< + * if index < 0 or index >= self.n_verts: + * raise IndexError + */ + +# line 1457 "core/core2.pyx" + if (unlikely(__pyx_v_indexes == Py_None)) { + +# line 1457 "core/core2.pyx" + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + +# line 1457 "core/core2.pyx" + __PYX_ERR(0, 1457, __pyx_L1_error) + +# line 1457 "core/core2.pyx" + } + +# line 1457 "core/core2.pyx" + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_indexes, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1457, __pyx_L1_error) + +# line 1457 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_4); + +# line 1457 "core/core2.pyx" + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1457, __pyx_L1_error) + +# line 1457 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + +# line 1457 "core/core2.pyx" + __pyx_v_index = __pyx_t_5; + + /* "core/core2.pyx":1458 + * for i in range(len(indexes)): + * index = indexes[i] + * if index < 0 or index >= self.n_verts: # <<<<<<<<<<<<<< + * raise IndexError + * self.m.verts[index] += delta + */ + +# line 1458 "core/core2.pyx" + __pyx_t_7 = ((__pyx_v_index < 0) != 0); + +# line 1458 "core/core2.pyx" + if (!__pyx_t_7) { + +# line 1458 "core/core2.pyx" + } else { + +# line 1458 "core/core2.pyx" + __pyx_t_6 = __pyx_t_7; + +# line 1458 "core/core2.pyx" + goto __pyx_L6_bool_binop_done; + +# line 1458 "core/core2.pyx" + } + +# line 1458 "core/core2.pyx" + __pyx_t_7 = ((__pyx_v_index >= __pyx_v_self->n_verts) != 0); + +# line 1458 "core/core2.pyx" + __pyx_t_6 = __pyx_t_7; + +# line 1458 "core/core2.pyx" + __pyx_L6_bool_binop_done:; + +# line 1458 "core/core2.pyx" + if (unlikely(__pyx_t_6)) { + + /* "core/core2.pyx":1459 + * index = indexes[i] + * if index < 0 or index >= self.n_verts: + * raise IndexError # <<<<<<<<<<<<<< + * self.m.verts[index] += delta + * self.prev_verts[index] += delta + */ + +# line 1459 "core/core2.pyx" + __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); + +# line 1459 "core/core2.pyx" + __PYX_ERR(0, 1459, __pyx_L1_error) + + /* "core/core2.pyx":1458 + * for i in range(len(indexes)): + * index = indexes[i] + * if index < 0 or index >= self.n_verts: # <<<<<<<<<<<<<< + * raise IndexError + * self.m.verts[index] += delta + */ + +# line 1458 "core/core2.pyx" + } + + /* "core/core2.pyx":1460 + * if index < 0 or index >= self.n_verts: + * raise IndexError + * self.m.verts[index] += delta # <<<<<<<<<<<<<< + * self.prev_verts[index] += delta + * + */ + +# line 1460 "core/core2.pyx" + (__pyx_v_self->m->verts[__pyx_v_index]) += __pyx_v_delta; + + /* "core/core2.pyx":1461 + * raise IndexError + * self.m.verts[index] += delta + * self.prev_verts[index] += delta # <<<<<<<<<<<<<< + * + * def snap_to_bvh(self, float factor=1, int cycle_quality=10, str snapping_mode='SURFACE'): + */ + +# line 1461 "core/core2.pyx" + (__pyx_v_self->prev_verts[__pyx_v_index]) += __pyx_v_delta; + +# line 1461 "core/core2.pyx" + } + + /* "core/core2.pyx":1453 + * return ret + * + * def move_verts(self, list indexes, float x, float y, float z): # <<<<<<<<<<<<<< + * cdef vec3 delta = vec3(x, y, z) + * cdef int i, index + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.move_verts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1463 + * self.prev_verts[index] += delta + * + * def snap_to_bvh(self, float factor=1, int cycle_quality=10, str snapping_mode='SURFACE'): # <<<<<<<<<<<<<< + * cdef int snapping_mode_ = {'SURFACE': 1, + * 'OUTSIDE': 2, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_21snap_to_bvh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_21snap_to_bvh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_factor; + int __pyx_v_cycle_quality; + PyObject *__pyx_v_snapping_mode = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("snap_to_bvh (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_factor,&__pyx_n_s_cycle_quality,&__pyx_n_s_snapping_mode,0}; + PyObject* values[3] = {0,0,0}; + values[2] = ((PyObject*)__pyx_n_u_SURFACE); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor); + if (value) { values[0] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cycle_quality); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_snapping_mode); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "snap_to_bvh") < 0)) __PYX_ERR(0, 1463, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_factor = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1463, __pyx_L3_error) + } else { + __pyx_v_factor = ((float)1.0); + } + if (values[1]) { + __pyx_v_cycle_quality = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_cycle_quality == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1463, __pyx_L3_error) + } else { + __pyx_v_cycle_quality = ((int)10); + } + __pyx_v_snapping_mode = ((PyObject*)values[2]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("snap_to_bvh", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1463, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.snap_to_bvh", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_snapping_mode), (&PyUnicode_Type), 1, "snapping_mode", 1))) __PYX_ERR(0, 1463, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_20snap_to_bvh(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), __pyx_v_factor, __pyx_v_cycle_quality, __pyx_v_snapping_mode); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_20snap_to_bvh(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor, int __pyx_v_cycle_quality, PyObject *__pyx_v_snapping_mode) { + int __pyx_v_snapping_mode_; + struct BvhNearestResult __pyx_v_result; + int __pyx_v_i; + vec3 __pyx_v_v; + float __pyx_v_snapping; + unsigned int __pyx_v_cycle; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + vec3 __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("snap_to_bvh", 0); + + /* "core/core2.pyx":1464 + * + * def snap_to_bvh(self, float factor=1, int cycle_quality=10, str snapping_mode='SURFACE'): + * cdef int snapping_mode_ = {'SURFACE': 1, # <<<<<<<<<<<<<< + * 'OUTSIDE': 2, + * 'INSIDE': 4}[snapping_mode] + */ + +# line 1464 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1464, __pyx_L1_error) + +# line 1464 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1464 "core/core2.pyx" + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_SURFACE, __pyx_int_1) < 0) __PYX_ERR(0, 1464, __pyx_L1_error) + +# line 1464 "core/core2.pyx" + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_OUTSIDE, __pyx_int_2) < 0) __PYX_ERR(0, 1464, __pyx_L1_error) + +# line 1464 "core/core2.pyx" + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_INSIDE, __pyx_int_4) < 0) __PYX_ERR(0, 1464, __pyx_L1_error) + + /* "core/core2.pyx":1466 + * cdef int snapping_mode_ = {'SURFACE': 1, + * 'OUTSIDE': 2, + * 'INSIDE': 4}[snapping_mode] # <<<<<<<<<<<<<< + * + * if not self.bvh: + */ + +# line 1466 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_t_1, __pyx_v_snapping_mode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error) + +# line 1466 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1466 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1466 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1466, __pyx_L1_error) + +# line 1466 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +# line 1466 "core/core2.pyx" + __pyx_v_snapping_mode_ = __pyx_t_3; + + /* "core/core2.pyx":1468 + * 'INSIDE': 4}[snapping_mode] + * + * if not self.bvh: # <<<<<<<<<<<<<< + * raise RuntimeError('No bvh avaliable') + * + */ + +# line 1468 "core/core2.pyx" + __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->bvh)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1468, __pyx_L1_error) + +# line 1468 "core/core2.pyx" + __pyx_t_5 = ((!__pyx_t_4) != 0); + +# line 1468 "core/core2.pyx" + if (unlikely(__pyx_t_5)) { + + /* "core/core2.pyx":1469 + * + * if not self.bvh: + * raise RuntimeError('No bvh avaliable') # <<<<<<<<<<<<<< + * + * cycle_quality = nabs(cycle_quality) + */ + +# line 1469 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1469, __pyx_L1_error) + +# line 1469 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1469 "core/core2.pyx" + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + +# line 1469 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +# line 1469 "core/core2.pyx" + __PYX_ERR(0, 1469, __pyx_L1_error) + + /* "core/core2.pyx":1468 + * 'INSIDE': 4}[snapping_mode] + * + * if not self.bvh: # <<<<<<<<<<<<<< + * raise RuntimeError('No bvh avaliable') + * + */ + +# line 1468 "core/core2.pyx" + } + + /* "core/core2.pyx":1471 + * raise RuntimeError('No bvh avaliable') + * + * cycle_quality = nabs(cycle_quality) # <<<<<<<<<<<<<< + * self.snap_count += 1 + * + */ + +# line 1471 "core/core2.pyx" + __pyx_v_cycle_quality = nabs(__pyx_v_cycle_quality); + + /* "core/core2.pyx":1472 + * + * cycle_quality = nabs(cycle_quality) + * self.snap_count += 1 # <<<<<<<<<<<<<< + * + * cdef BvhNearestResult result + */ + +# line 1472 "core/core2.pyx" + __pyx_v_self->snap_count = (__pyx_v_self->snap_count + 1); + + /* "core/core2.pyx":1480 + * cdef unsigned int cycle + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * cycle = (i ^ 0x243F6A88) * 0x243F6A88 + */ + +# line 1480 "core/core2.pyx" + { + +# line 1480 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1480 "core/core2.pyx" + PyThreadState *_save; + +# line 1480 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1480 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1480 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1481 + * + * with nogil: + * for i in prange(self.n_verts): # <<<<<<<<<<<<<< + * cycle = (i ^ 0x243F6A88) * 0x243F6A88 + * cycle = cycle ^ cycle >> 5 + */ + +# line 1481 "core/core2.pyx" + __pyx_t_3 = __pyx_v_self->n_verts; + +# line 1481 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1481 "core/core2.pyx" + { + +# line 1481 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1481 "core/core2.pyx" + #undef likely + +# line 1481 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1481 "core/core2.pyx" + #endif + +# line 1481 "core/core2.pyx" + __pyx_t_7 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + +# line 1481 "core/core2.pyx" + if (__pyx_t_7 > 0) + +# line 1481 "core/core2.pyx" + { + +# line 1481 "core/core2.pyx" + #ifdef _OPENMP + +# line 1481 "core/core2.pyx" + #pragma omp parallel private(__pyx_t_4, __pyx_t_5, __pyx_t_8, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_cycle) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_result) lastprivate(__pyx_v_snapping) lastprivate(__pyx_v_v) + #endif /* _OPENMP */ + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_6); + /* Initialize private variables to invalid values */ + __pyx_v_cycle = ((unsigned int)0xbad0bad0); + __pyx_v_snapping = ((float)__PYX_NAN()); + + /* "core/core2.pyx":1482 + * with nogil: + * for i in prange(self.n_verts): + * cycle = (i ^ 0x243F6A88) * 0x243F6A88 # <<<<<<<<<<<<<< + * cycle = cycle ^ cycle >> 5 + * cycle = cycle + self.snap_count + */ + +# line 1482 "core/core2.pyx" + __pyx_v_cycle = ((((unsigned int)__pyx_v_i) ^ ((unsigned int)0x243F6A88)) * ((unsigned int)0x243F6A88)); + + /* "core/core2.pyx":1483 + * for i in prange(self.n_verts): + * cycle = (i ^ 0x243F6A88) * 0x243F6A88 + * cycle = cycle ^ cycle >> 5 # <<<<<<<<<<<<<< + * cycle = cycle + self.snap_count + * + */ + +# line 1483 "core/core2.pyx" + __pyx_v_cycle = (__pyx_v_cycle ^ (__pyx_v_cycle >> 5)); + + /* "core/core2.pyx":1484 + * cycle = (i ^ 0x243F6A88) * 0x243F6A88 + * cycle = cycle ^ cycle >> 5 + * cycle = cycle + self.snap_count # <<<<<<<<<<<<<< + * + * if cycle % cycle_quality > 0 and self.bvh_closest_indexes[i] >= 0: + */ + +# line 1484 "core/core2.pyx" + __pyx_v_cycle = (__pyx_v_cycle + __pyx_v_self->snap_count); + + /* "core/core2.pyx":1486 + * cycle = cycle + self.snap_count + * + * if cycle % cycle_quality > 0 and self.bvh_closest_indexes[i] >= 0: # <<<<<<<<<<<<<< + * result.tri_index = self.bvh_closest_indexes[i] + * result.point = project_point_plane( + */ + +# line 1486 "core/core2.pyx" + __pyx_t_4 = (((__pyx_v_cycle % __pyx_v_cycle_quality) > 0) != 0); + +# line 1486 "core/core2.pyx" + if (__pyx_t_4) { + +# line 1486 "core/core2.pyx" + } else { + +# line 1486 "core/core2.pyx" + __pyx_t_5 = __pyx_t_4; + +# line 1486 "core/core2.pyx" + goto __pyx_L12_bool_binop_done; + +# line 1486 "core/core2.pyx" + } + +# line 1486 "core/core2.pyx" + __pyx_t_4 = (((__pyx_v_self->bvh_closest_indexes[__pyx_v_i]) >= 0) != 0); + +# line 1486 "core/core2.pyx" + __pyx_t_5 = __pyx_t_4; + +# line 1486 "core/core2.pyx" + __pyx_L12_bool_binop_done:; + +# line 1486 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1487 + * + * if cycle % cycle_quality > 0 and self.bvh_closest_indexes[i] >= 0: + * result.tri_index = self.bvh_closest_indexes[i] # <<<<<<<<<<<<<< + * result.point = project_point_plane( + * self.m.verts[i], + */ + +# line 1487 "core/core2.pyx" + __pyx_v_result.tri_index = (__pyx_v_self->bvh_closest_indexes[__pyx_v_i]); + + /* "core/core2.pyx":1488 + * if cycle % cycle_quality > 0 and self.bvh_closest_indexes[i] >= 0: + * result.tri_index = self.bvh_closest_indexes[i] + * result.point = project_point_plane( # <<<<<<<<<<<<<< + * self.m.verts[i], + * self.bvh.mesh.verts[self.bvh.mesh.triangles[result.tri_index][0]], + */ + +# line 1488 "core/core2.pyx" + __pyx_v_result.point = project_point_plane((__pyx_v_self->m->verts[__pyx_v_i]), (__pyx_v_self->bvh->mesh->verts[((__pyx_v_self->bvh->mesh->triangles[__pyx_v_result.tri_index])[0])]), (__pyx_v_self->bvh->mesh->face_normals[__pyx_v_result.tri_index])); + + /* "core/core2.pyx":1486 + * cycle = cycle + self.snap_count + * + * if cycle % cycle_quality > 0 and self.bvh_closest_indexes[i] >= 0: # <<<<<<<<<<<<<< + * result.tri_index = self.bvh_closest_indexes[i] + * result.point = project_point_plane( + */ + +# line 1486 "core/core2.pyx" + goto __pyx_L11; + +# line 1486 "core/core2.pyx" + } + + /* "core/core2.pyx":1494 + * ) + * else: + * result = self.bvh._find_nearest(self.m.verts[i]) # <<<<<<<<<<<<<< + * self.bvh_closest_indexes[i] = result.tri_index + * + */ + /*else*/ { + __pyx_v_result = __pyx_f_14softwrap_core2_3BVH__find_nearest(__pyx_v_self->bvh, (__pyx_v_self->m->verts[__pyx_v_i])); + + /* "core/core2.pyx":1495 + * else: + * result = self.bvh._find_nearest(self.m.verts[i]) + * self.bvh_closest_indexes[i] = result.tri_index # <<<<<<<<<<<<<< + * + * v = result.point - self.m.verts[i] + */ + +# line 1495 "core/core2.pyx" + __pyx_t_8 = __pyx_v_result.tri_index; + +# line 1495 "core/core2.pyx" + (__pyx_v_self->bvh_closest_indexes[__pyx_v_i]) = __pyx_t_8; + +# line 1495 "core/core2.pyx" + } + +# line 1495 "core/core2.pyx" + __pyx_L11:; + + /* "core/core2.pyx":1497 + * self.bvh_closest_indexes[i] = result.tri_index + * + * v = result.point - self.m.verts[i] # <<<<<<<<<<<<<< + * + * if snapping_mode_ & 1: + */ + +# line 1497 "core/core2.pyx" + __pyx_v_v = (__pyx_v_result.point - (__pyx_v_self->m->verts[__pyx_v_i])); + + /* "core/core2.pyx":1499 + * v = result.point - self.m.verts[i] + * + * if snapping_mode_ & 1: # <<<<<<<<<<<<<< + * if v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0: + * if v.dot(self.m.vert_normals[i]) < 0: + */ + +# line 1499 "core/core2.pyx" + __pyx_t_5 = ((__pyx_v_snapping_mode_ & 1) != 0); + +# line 1499 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1500 + * + * if snapping_mode_ & 1: + * if v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0: # <<<<<<<<<<<<<< + * if v.dot(self.m.vert_normals[i]) < 0: + * v = self.m.vert_normals[i] * v.len() + v * 0.5 + */ + +# line 1500 "core/core2.pyx" + __pyx_t_5 = ((__pyx_v_v.dot((__pyx_v_self->bvh->mesh->face_normals[__pyx_v_result.tri_index])) > 0.0) != 0); + +# line 1500 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1501 + * if snapping_mode_ & 1: + * if v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0: + * if v.dot(self.m.vert_normals[i]) < 0: # <<<<<<<<<<<<<< + * v = self.m.vert_normals[i] * v.len() + v * 0.5 + * + */ + +# line 1501 "core/core2.pyx" + __pyx_t_5 = ((__pyx_v_v.dot((__pyx_v_self->m->vert_normals[__pyx_v_i])) < 0.0) != 0); + +# line 1501 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1502 + * if v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0: + * if v.dot(self.m.vert_normals[i]) < 0: + * v = self.m.vert_normals[i] * v.len() + v * 0.5 # <<<<<<<<<<<<<< + * + * + */ + +# line 1502 "core/core2.pyx" + __pyx_v_v = (((__pyx_v_self->m->vert_normals[__pyx_v_i]) * __pyx_v_v.len()) + (__pyx_v_v * 0.5)); + + /* "core/core2.pyx":1501 + * if snapping_mode_ & 1: + * if v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0: + * if v.dot(self.m.vert_normals[i]) < 0: # <<<<<<<<<<<<<< + * v = self.m.vert_normals[i] * v.len() + v * 0.5 + * + */ + +# line 1501 "core/core2.pyx" + } + + /* "core/core2.pyx":1500 + * + * if snapping_mode_ & 1: + * if v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0: # <<<<<<<<<<<<<< + * if v.dot(self.m.vert_normals[i]) < 0: + * v = self.m.vert_normals[i] * v.len() + v * 0.5 + */ + +# line 1500 "core/core2.pyx" + } + + /* "core/core2.pyx":1505 + * + * + * snapping = self.m.vert_normals[i].dot(self.bvh.mesh.face_normals[result.tri_index]) # <<<<<<<<<<<<<< + * snapping = snapping * snapping + * + */ + +# line 1505 "core/core2.pyx" + __pyx_v_snapping = (__pyx_v_self->m->vert_normals[__pyx_v_i]).dot((__pyx_v_self->bvh->mesh->face_normals[__pyx_v_result.tri_index])); + + /* "core/core2.pyx":1506 + * + * snapping = self.m.vert_normals[i].dot(self.bvh.mesh.face_normals[result.tri_index]) + * snapping = snapping * snapping # <<<<<<<<<<<<<< + * + * v = v * factor * snapping + */ + +# line 1506 "core/core2.pyx" + __pyx_v_snapping = (__pyx_v_snapping * __pyx_v_snapping); + + /* "core/core2.pyx":1508 + * snapping = snapping * snapping + * + * v = v * factor * snapping # <<<<<<<<<<<<<< + * self.m.verts[i] += v + * + */ + +# line 1508 "core/core2.pyx" + __pyx_v_v = ((__pyx_v_v * __pyx_v_factor) * __pyx_v_snapping); + + /* "core/core2.pyx":1509 + * + * v = v * factor * snapping + * self.m.verts[i] += v # <<<<<<<<<<<<<< + * + * elif snapping_mode_ & (2 | 4): + */ + +# line 1509 "core/core2.pyx" + (__pyx_v_self->m->verts[__pyx_v_i]) += __pyx_v_v; + + /* "core/core2.pyx":1499 + * v = result.point - self.m.verts[i] + * + * if snapping_mode_ & 1: # <<<<<<<<<<<<<< + * if v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0: + * if v.dot(self.m.vert_normals[i]) < 0: + */ + +# line 1499 "core/core2.pyx" + goto __pyx_L14; + +# line 1499 "core/core2.pyx" + } + + /* "core/core2.pyx":1511 + * self.m.verts[i] += v + * + * elif snapping_mode_ & (2 | 4): # <<<<<<<<<<<<<< + * if (v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0) ^ (snapping_mode_ & 4 > 0): + * v = self.m.verts[i] = result.point + */ + +# line 1511 "core/core2.pyx" + __pyx_t_5 = ((__pyx_v_snapping_mode_ & 6) != 0); + +# line 1511 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1512 + * + * elif snapping_mode_ & (2 | 4): + * if (v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0) ^ (snapping_mode_ & 4 > 0): # <<<<<<<<<<<<<< + * v = self.m.verts[i] = result.point + * + */ + +# line 1512 "core/core2.pyx" + __pyx_t_5 = (((__pyx_v_v.dot((__pyx_v_self->bvh->mesh->face_normals[__pyx_v_result.tri_index])) > 0.0) ^ ((__pyx_v_snapping_mode_ & 4) > 0)) != 0); + +# line 1512 "core/core2.pyx" + if (__pyx_t_5) { + + /* "core/core2.pyx":1513 + * elif snapping_mode_ & (2 | 4): + * if (v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0) ^ (snapping_mode_ & 4 > 0): + * v = self.m.verts[i] = result.point # <<<<<<<<<<<<<< + * + * cpdef SpringLinks create_spring_group(self, list links): + */ + +# line 1513 "core/core2.pyx" + __pyx_t_9 = __pyx_v_result.point; + +# line 1513 "core/core2.pyx" + __pyx_v_v = __pyx_t_9; + +# line 1513 "core/core2.pyx" + (__pyx_v_self->m->verts[__pyx_v_i]) = __pyx_t_9; + + /* "core/core2.pyx":1512 + * + * elif snapping_mode_ & (2 | 4): + * if (v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0) ^ (snapping_mode_ & 4 > 0): # <<<<<<<<<<<<<< + * v = self.m.verts[i] = result.point + * + */ + +# line 1512 "core/core2.pyx" + } + + /* "core/core2.pyx":1511 + * self.m.verts[i] += v + * + * elif snapping_mode_ & (2 | 4): # <<<<<<<<<<<<<< + * if (v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0) ^ (snapping_mode_ & 4 > 0): + * v = self.m.verts[i] = result.point + */ + +# line 1511 "core/core2.pyx" + } + +# line 1511 "core/core2.pyx" + __pyx_L14:; + +# line 1511 "core/core2.pyx" + } + +# line 1511 "core/core2.pyx" + } + +# line 1511 "core/core2.pyx" + } + +# line 1511 "core/core2.pyx" + } + +# line 1511 "core/core2.pyx" + } + +# line 1511 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1511 "core/core2.pyx" + #undef likely + +# line 1511 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1511 "core/core2.pyx" + #endif + +# line 1511 "core/core2.pyx" + } + + /* "core/core2.pyx":1480 + * cdef unsigned int cycle + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * cycle = (i ^ 0x243F6A88) * 0x243F6A88 + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":1463 + * self.prev_verts[index] += delta + * + * def snap_to_bvh(self, float factor=1, int cycle_quality=10, str snapping_mode='SURFACE'): # <<<<<<<<<<<<<< + * cdef int snapping_mode_ = {'SURFACE': 1, + * 'OUTSIDE': 2, + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.snap_to_bvh", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1515 + * v = self.m.verts[i] = result.point + * + * cpdef SpringLinks create_spring_group(self, list links): # <<<<<<<<<<<<<< + * return SpringLinks(self, links) + * + */ + +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_23create_spring_group(PyObject *__pyx_v_self, PyObject *__pyx_v_links); /*proto*/ +static struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_f_14softwrap_core2_12SpringEngine_create_spring_group(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links, int __pyx_skip_dispatch) { + struct __pyx_obj_14softwrap_core2_SpringLinks *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_spring_group", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_spring_group); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_12SpringEngine_23create_spring_group)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_links) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_links); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_14softwrap_core2_SpringLinks))))) __PYX_ERR(0, 1515, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1516 + * + * cpdef SpringLinks create_spring_group(self, list links): + * return SpringLinks(self, links) # <<<<<<<<<<<<<< + * + * cpdef SymmetryMap create_symmetry_map(self): + */ + +# line 1516 "core/core2.pyx" + __Pyx_XDECREF(((PyObject *)__pyx_r)); + +# line 1516 "core/core2.pyx" + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1516, __pyx_L1_error) + +# line 1516 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1516 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + +# line 1516 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + +# line 1516 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + +# line 1516 "core/core2.pyx" + __Pyx_INCREF(__pyx_v_links); + +# line 1516 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_v_links); + +# line 1516 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_links); + +# line 1516 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14softwrap_core2_SpringLinks), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1516, __pyx_L1_error) + +# line 1516 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1516 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1516 "core/core2.pyx" + __pyx_r = ((struct __pyx_obj_14softwrap_core2_SpringLinks *)__pyx_t_2); + +# line 1516 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 1516 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1515 + * v = self.m.verts[i] = result.point + * + * cpdef SpringLinks create_spring_group(self, list links): # <<<<<<<<<<<<<< + * return SpringLinks(self, links) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_spring_group", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_23create_spring_group(PyObject *__pyx_v_self, PyObject *__pyx_v_links); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_23create_spring_group(PyObject *__pyx_v_self, PyObject *__pyx_v_links) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create_spring_group (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_links), (&PyList_Type), 1, "links", 1))) __PYX_ERR(0, 1515, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_22create_spring_group(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((PyObject*)__pyx_v_links)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_22create_spring_group(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_spring_group", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_14softwrap_core2_12SpringEngine_create_spring_group(__pyx_v_self, __pyx_v_links, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_spring_group", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1518 + * return SpringLinks(self, links) + * + * cpdef SymmetryMap create_symmetry_map(self): # <<<<<<<<<<<<<< + * return SymmetryMap(self) + * + */ + +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_25create_symmetry_map(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_f_14softwrap_core2_12SpringEngine_create_symmetry_map(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_14softwrap_core2_SymmetryMap *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_symmetry_map", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_symmetry_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_12SpringEngine_25create_symmetry_map)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_14softwrap_core2_SymmetryMap))))) __PYX_ERR(0, 1518, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_14softwrap_core2_SymmetryMap *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1519 + * + * cpdef SymmetryMap create_symmetry_map(self): + * return SymmetryMap(self) # <<<<<<<<<<<<<< + * + * cpdef TernarySmoothingLinks create_ternary_links(self, list links): + */ + +# line 1519 "core/core2.pyx" + __Pyx_XDECREF(((PyObject *)__pyx_r)); + +# line 1519 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_14softwrap_core2_SymmetryMap), ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1519, __pyx_L1_error) + +# line 1519 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1519 "core/core2.pyx" + __pyx_r = ((struct __pyx_obj_14softwrap_core2_SymmetryMap *)__pyx_t_1); + +# line 1519 "core/core2.pyx" + __pyx_t_1 = 0; + +# line 1519 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1518 + * return SpringLinks(self, links) + * + * cpdef SymmetryMap create_symmetry_map(self): # <<<<<<<<<<<<<< + * return SymmetryMap(self) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_symmetry_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_25create_symmetry_map(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_25create_symmetry_map(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create_symmetry_map (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_24create_symmetry_map(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_24create_symmetry_map(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_symmetry_map", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_14softwrap_core2_12SpringEngine_create_symmetry_map(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_symmetry_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1521 + * return SymmetryMap(self) + * + * cpdef TernarySmoothingLinks create_ternary_links(self, list links): # <<<<<<<<<<<<<< + * return TernarySmoothingLinks(self, links) + * + */ + +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_27create_ternary_links(PyObject *__pyx_v_self, PyObject *__pyx_v_links); /*proto*/ +static struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_f_14softwrap_core2_12SpringEngine_create_ternary_links(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links, int __pyx_skip_dispatch) { + struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_ternary_links", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_ternary_links); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_12SpringEngine_27create_ternary_links)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_links) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_links); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_14softwrap_core2_TernarySmoothingLinks))))) __PYX_ERR(0, 1521, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1522 + * + * cpdef TernarySmoothingLinks create_ternary_links(self, list links): + * return TernarySmoothingLinks(self, links) # <<<<<<<<<<<<<< + * + * cpdef QuaternarySmoothingLinks create_quaternary_links(self, list links): + */ + +# line 1522 "core/core2.pyx" + __Pyx_XDECREF(((PyObject *)__pyx_r)); + +# line 1522 "core/core2.pyx" + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error) + +# line 1522 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1522 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + +# line 1522 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + +# line 1522 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + +# line 1522 "core/core2.pyx" + __Pyx_INCREF(__pyx_v_links); + +# line 1522 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_v_links); + +# line 1522 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_links); + +# line 1522 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14softwrap_core2_TernarySmoothingLinks), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1522, __pyx_L1_error) + +# line 1522 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1522 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1522 "core/core2.pyx" + __pyx_r = ((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)__pyx_t_2); + +# line 1522 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 1522 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1521 + * return SymmetryMap(self) + * + * cpdef TernarySmoothingLinks create_ternary_links(self, list links): # <<<<<<<<<<<<<< + * return TernarySmoothingLinks(self, links) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_ternary_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_27create_ternary_links(PyObject *__pyx_v_self, PyObject *__pyx_v_links); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_27create_ternary_links(PyObject *__pyx_v_self, PyObject *__pyx_v_links) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create_ternary_links (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_links), (&PyList_Type), 1, "links", 1))) __PYX_ERR(0, 1521, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_26create_ternary_links(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((PyObject*)__pyx_v_links)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_26create_ternary_links(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_ternary_links", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_14softwrap_core2_12SpringEngine_create_ternary_links(__pyx_v_self, __pyx_v_links, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_ternary_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1524 + * return TernarySmoothingLinks(self, links) + * + * cpdef QuaternarySmoothingLinks create_quaternary_links(self, list links): # <<<<<<<<<<<<<< + * return QuaternarySmoothingLinks(self, links) + * + */ + +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_29create_quaternary_links(PyObject *__pyx_v_self, PyObject *__pyx_v_links); /*proto*/ +static struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_f_14softwrap_core2_12SpringEngine_create_quaternary_links(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links, int __pyx_skip_dispatch) { + struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_quaternary_links", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_quaternary_links); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1524, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_12SpringEngine_29create_quaternary_links)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_links) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_links); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1524, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_14softwrap_core2_QuaternarySmoothingLinks))))) __PYX_ERR(0, 1524, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1525 + * + * cpdef QuaternarySmoothingLinks create_quaternary_links(self, list links): + * return QuaternarySmoothingLinks(self, links) # <<<<<<<<<<<<<< + * + * cpdef SpringEngineMask create_mask(self, mask): + */ + +# line 1525 "core/core2.pyx" + __Pyx_XDECREF(((PyObject *)__pyx_r)); + +# line 1525 "core/core2.pyx" + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1525, __pyx_L1_error) + +# line 1525 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1525 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + +# line 1525 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + +# line 1525 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + +# line 1525 "core/core2.pyx" + __Pyx_INCREF(__pyx_v_links); + +# line 1525 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_v_links); + +# line 1525 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_links); + +# line 1525 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14softwrap_core2_QuaternarySmoothingLinks), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1525, __pyx_L1_error) + +# line 1525 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1525 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1525 "core/core2.pyx" + __pyx_r = ((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)__pyx_t_2); + +# line 1525 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 1525 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1524 + * return TernarySmoothingLinks(self, links) + * + * cpdef QuaternarySmoothingLinks create_quaternary_links(self, list links): # <<<<<<<<<<<<<< + * return QuaternarySmoothingLinks(self, links) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_quaternary_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_29create_quaternary_links(PyObject *__pyx_v_self, PyObject *__pyx_v_links); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_29create_quaternary_links(PyObject *__pyx_v_self, PyObject *__pyx_v_links) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create_quaternary_links (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_links), (&PyList_Type), 1, "links", 1))) __PYX_ERR(0, 1524, __pyx_L1_error) + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_28create_quaternary_links(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((PyObject*)__pyx_v_links)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_28create_quaternary_links(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_links) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_quaternary_links", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_14softwrap_core2_12SpringEngine_create_quaternary_links(__pyx_v_self, __pyx_v_links, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1524, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_quaternary_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1527 + * return QuaternarySmoothingLinks(self, links) + * + * cpdef SpringEngineMask create_mask(self, mask): # <<<<<<<<<<<<<< + * return SpringEngineMask(self, mask) + * + */ + +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_31create_mask(PyObject *__pyx_v_self, PyObject *__pyx_v_mask); /*proto*/ +static struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_f_14softwrap_core2_12SpringEngine_create_mask(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_mask, int __pyx_skip_dispatch) { + struct __pyx_obj_14softwrap_core2_SpringEngineMask *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_mask", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1527, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_12SpringEngine_31create_mask)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_mask) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_mask); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1527, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_14softwrap_core2_SpringEngineMask))))) __PYX_ERR(0, 1527, __pyx_L1_error) + __pyx_r = ((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1528 + * + * cpdef SpringEngineMask create_mask(self, mask): + * return SpringEngineMask(self, mask) # <<<<<<<<<<<<<< + * + * cpdef void random_verts(self, float factor, unsigned int seed=0x452821E6): + */ + +# line 1528 "core/core2.pyx" + __Pyx_XDECREF(((PyObject *)__pyx_r)); + +# line 1528 "core/core2.pyx" + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1528, __pyx_L1_error) + +# line 1528 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 1528 "core/core2.pyx" + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + +# line 1528 "core/core2.pyx" + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + +# line 1528 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + +# line 1528 "core/core2.pyx" + __Pyx_INCREF(__pyx_v_mask); + +# line 1528 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_v_mask); + +# line 1528 "core/core2.pyx" + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_mask); + +# line 1528 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14softwrap_core2_SpringEngineMask), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1528, __pyx_L1_error) + +# line 1528 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 1528 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 1528 "core/core2.pyx" + __pyx_r = ((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)__pyx_t_2); + +# line 1528 "core/core2.pyx" + __pyx_t_2 = 0; + +# line 1528 "core/core2.pyx" + goto __pyx_L0; + + /* "core/core2.pyx":1527 + * return QuaternarySmoothingLinks(self, links) + * + * cpdef SpringEngineMask create_mask(self, mask): # <<<<<<<<<<<<<< + * return SpringEngineMask(self, mask) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_mask", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_31create_mask(PyObject *__pyx_v_self, PyObject *__pyx_v_mask); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_31create_mask(PyObject *__pyx_v_self, PyObject *__pyx_v_mask) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create_mask (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_30create_mask(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((PyObject *)__pyx_v_mask)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_30create_mask(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, PyObject *__pyx_v_mask) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_mask", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_14softwrap_core2_12SpringEngine_create_mask(__pyx_v_self, __pyx_v_mask, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1527, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.create_mask", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1530 + * return SpringEngineMask(self, mask) + * + * cpdef void random_verts(self, float factor, unsigned int seed=0x452821E6): # <<<<<<<<<<<<<< + * cdef int i + * cdef unsigned int xorstate = 0x452821E6 + */ + +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_33random_verts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_14softwrap_core2_12SpringEngine_random_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_12SpringEngine_random_verts *__pyx_optional_args) { + unsigned int __pyx_v_seed = ((unsigned int)0x452821E6); + int __pyx_v_i; + unsigned int __pyx_v_xorstate; + vec3 __pyx_v_v; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("random_verts", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_seed = __pyx_optional_args->seed; + } + } + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_random_verts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_12SpringEngine_33random_verts)) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_factor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_seed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1532 + * cpdef void random_verts(self, float factor, unsigned int seed=0x452821E6): + * cdef int i + * cdef unsigned int xorstate = 0x452821E6 # <<<<<<<<<<<<<< + * cdef vec3 v + * with nogil: + */ + +# line 1532 "core/core2.pyx" + __pyx_v_xorstate = 0x452821E6; + + /* "core/core2.pyx":1534 + * cdef unsigned int xorstate = 0x452821E6 + * cdef vec3 v + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * v = vec3(xorshiftf(&xorstate), xorshiftf(&xorstate), xorshiftf(&xorstate)) * factor + */ + +# line 1534 "core/core2.pyx" + { + +# line 1534 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1534 "core/core2.pyx" + PyThreadState *_save; + +# line 1534 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1534 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1534 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1535 + * cdef vec3 v + * with nogil: + * for i in prange(self.n_verts): # <<<<<<<<<<<<<< + * v = vec3(xorshiftf(&xorstate), xorshiftf(&xorstate), xorshiftf(&xorstate)) * factor + * self.m.verts[i] += v + */ + +# line 1535 "core/core2.pyx" + __pyx_t_7 = __pyx_v_self->n_verts; + +# line 1535 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1535 "core/core2.pyx" + { + +# line 1535 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1535 "core/core2.pyx" + #undef likely + +# line 1535 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1535 "core/core2.pyx" + #endif + +# line 1535 "core/core2.pyx" + __pyx_t_10 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1; + +# line 1535 "core/core2.pyx" + if (__pyx_t_10 > 0) + +# line 1535 "core/core2.pyx" + { + +# line 1535 "core/core2.pyx" + #ifdef _OPENMP + +# line 1535 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_v) + #endif /* _OPENMP */ + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_9); + + /* "core/core2.pyx":1536 + * with nogil: + * for i in prange(self.n_verts): + * v = vec3(xorshiftf(&xorstate), xorshiftf(&xorstate), xorshiftf(&xorstate)) * factor # <<<<<<<<<<<<<< + * self.m.verts[i] += v + * self.prev_verts[i] += v + */ + +# line 1536 "core/core2.pyx" + __pyx_v_v = (vec3(__pyx_f_14softwrap_core2_xorshiftf((&__pyx_v_xorstate)), __pyx_f_14softwrap_core2_xorshiftf((&__pyx_v_xorstate)), __pyx_f_14softwrap_core2_xorshiftf((&__pyx_v_xorstate))) * __pyx_v_factor); + + /* "core/core2.pyx":1537 + * for i in prange(self.n_verts): + * v = vec3(xorshiftf(&xorstate), xorshiftf(&xorstate), xorshiftf(&xorstate)) * factor + * self.m.verts[i] += v # <<<<<<<<<<<<<< + * self.prev_verts[i] += v + * + */ + +# line 1537 "core/core2.pyx" + (__pyx_v_self->m->verts[__pyx_v_i]) += __pyx_v_v; + + /* "core/core2.pyx":1538 + * v = vec3(xorshiftf(&xorstate), xorshiftf(&xorstate), xorshiftf(&xorstate)) * factor + * self.m.verts[i] += v + * self.prev_verts[i] += v # <<<<<<<<<<<<<< + * + * cpdef void kinetic_step(self, float damping): + */ + +# line 1538 "core/core2.pyx" + (__pyx_v_self->prev_verts[__pyx_v_i]) += __pyx_v_v; + +# line 1538 "core/core2.pyx" + } + +# line 1538 "core/core2.pyx" + } + +# line 1538 "core/core2.pyx" + } + +# line 1538 "core/core2.pyx" + } + +# line 1538 "core/core2.pyx" + } + +# line 1538 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1538 "core/core2.pyx" + #undef likely + +# line 1538 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1538 "core/core2.pyx" + #endif + +# line 1538 "core/core2.pyx" + } + + /* "core/core2.pyx":1534 + * cdef unsigned int xorstate = 0x452821E6 + * cdef vec3 v + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * v = vec3(xorshiftf(&xorstate), xorshiftf(&xorstate), xorshiftf(&xorstate)) * factor + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "core/core2.pyx":1530 + * return SpringEngineMask(self, mask) + * + * cpdef void random_verts(self, float factor, unsigned int seed=0x452821E6): # <<<<<<<<<<<<<< + * cdef int i + * cdef unsigned int xorstate = 0x452821E6 + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("softwrap_core2.SpringEngine.random_verts", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_33random_verts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_33random_verts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_factor; + unsigned int __pyx_v_seed; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("random_verts (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_factor,&__pyx_n_s_seed,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "random_verts") < 0)) __PYX_ERR(0, 1530, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_factor = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1530, __pyx_L3_error) + if (values[1]) { + __pyx_v_seed = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1530, __pyx_L3_error) + } else { + __pyx_v_seed = ((unsigned int)0x452821E6); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("random_verts", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1530, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.random_verts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_32random_verts(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), __pyx_v_factor, __pyx_v_seed); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_32random_verts(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor, unsigned int __pyx_v_seed) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_opt_args_14softwrap_core2_12SpringEngine_random_verts __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("random_verts", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1.__pyx_n = 1; + __pyx_t_1.seed = __pyx_v_seed; + __pyx_vtabptr_14softwrap_core2_SpringEngine->random_verts(__pyx_v_self, __pyx_v_factor, 1, &__pyx_t_1); + __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.random_verts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1540 + * self.prev_verts[i] += v + * + * cpdef void kinetic_step(self, float damping): # <<<<<<<<<<<<<< + * cdef int i + * + */ + +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_35kinetic_step(PyObject *__pyx_v_self, PyObject *__pyx_arg_damping); /*proto*/ +static void __pyx_f_14softwrap_core2_12SpringEngine_kinetic_step(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_damping, int __pyx_skip_dispatch) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + vec3 *__pyx_t_9; + vec3 *__pyx_t_10; + vec3 *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("kinetic_step", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kinetic_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_12SpringEngine_35kinetic_step)) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_damping); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1543 + * cdef int i + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * self.tmp_verts[i] = (self.m.verts[i] - self.prev_verts[i]) * damping + self.m.verts[i] + */ + +# line 1543 "core/core2.pyx" + { + +# line 1543 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1543 "core/core2.pyx" + PyThreadState *_save; + +# line 1543 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1543 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1543 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1544 + * + * with nogil: + * for i in prange(self.n_verts): # <<<<<<<<<<<<<< + * self.tmp_verts[i] = (self.m.verts[i] - self.prev_verts[i]) * damping + self.m.verts[i] + * + */ + +# line 1544 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->n_verts; + +# line 1544 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1544 "core/core2.pyx" + { + +# line 1544 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1544 "core/core2.pyx" + #undef likely + +# line 1544 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1544 "core/core2.pyx" + #endif + +# line 1544 "core/core2.pyx" + __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; + +# line 1544 "core/core2.pyx" + if (__pyx_t_8 > 0) + +# line 1544 "core/core2.pyx" + { + +# line 1544 "core/core2.pyx" + #ifdef _OPENMP + +# line 1544 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); + + /* "core/core2.pyx":1545 + * with nogil: + * for i in prange(self.n_verts): + * self.tmp_verts[i] = (self.m.verts[i] - self.prev_verts[i]) * damping + self.m.verts[i] # <<<<<<<<<<<<<< + * + * self.prev_verts, self.m.verts, self.tmp_verts = self.m.verts, self.tmp_verts, self.prev_verts + */ + +# line 1545 "core/core2.pyx" + (__pyx_v_self->tmp_verts[__pyx_v_i]) = ((((__pyx_v_self->m->verts[__pyx_v_i]) - (__pyx_v_self->prev_verts[__pyx_v_i])) * __pyx_v_damping) + (__pyx_v_self->m->verts[__pyx_v_i])); + +# line 1545 "core/core2.pyx" + } + +# line 1545 "core/core2.pyx" + } + +# line 1545 "core/core2.pyx" + } + +# line 1545 "core/core2.pyx" + } + +# line 1545 "core/core2.pyx" + } + +# line 1545 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1545 "core/core2.pyx" + #undef likely + +# line 1545 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1545 "core/core2.pyx" + #endif + +# line 1545 "core/core2.pyx" + } + + /* "core/core2.pyx":1543 + * cdef int i + * + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * self.tmp_verts[i] = (self.m.verts[i] - self.prev_verts[i]) * damping + self.m.verts[i] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "core/core2.pyx":1547 + * self.tmp_verts[i] = (self.m.verts[i] - self.prev_verts[i]) * damping + self.m.verts[i] + * + * self.prev_verts, self.m.verts, self.tmp_verts = self.m.verts, self.tmp_verts, self.prev_verts # <<<<<<<<<<<<<< + * + * cpdef void update_mesh_normals(self, float factor): + */ + +# line 1547 "core/core2.pyx" + __pyx_t_9 = __pyx_v_self->m->verts; + +# line 1547 "core/core2.pyx" + __pyx_t_10 = __pyx_v_self->tmp_verts; + +# line 1547 "core/core2.pyx" + __pyx_t_11 = __pyx_v_self->prev_verts; + +# line 1547 "core/core2.pyx" + __pyx_v_self->prev_verts = __pyx_t_9; + +# line 1547 "core/core2.pyx" + __pyx_v_self->m->verts = __pyx_t_10; + +# line 1547 "core/core2.pyx" + __pyx_v_self->tmp_verts = __pyx_t_11; + + /* "core/core2.pyx":1540 + * self.prev_verts[i] += v + * + * cpdef void kinetic_step(self, float damping): # <<<<<<<<<<<<<< + * cdef int i + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("softwrap_core2.SpringEngine.kinetic_step", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_35kinetic_step(PyObject *__pyx_v_self, PyObject *__pyx_arg_damping); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_35kinetic_step(PyObject *__pyx_v_self, PyObject *__pyx_arg_damping) { + float __pyx_v_damping; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("kinetic_step (wrapper)", 0); + assert(__pyx_arg_damping); { + __pyx_v_damping = __pyx_PyFloat_AsFloat(__pyx_arg_damping); if (unlikely((__pyx_v_damping == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1540, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.kinetic_step", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_34kinetic_step(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((float)__pyx_v_damping)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_34kinetic_step(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_damping) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("kinetic_step", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_12SpringEngine_kinetic_step(__pyx_v_self, __pyx_v_damping, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.kinetic_step", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "core/core2.pyx":1549 + * self.prev_verts, self.m.verts, self.tmp_verts = self.m.verts, self.tmp_verts, self.prev_verts + * + * cpdef void update_mesh_normals(self, float factor): # <<<<<<<<<<<<<< + * self.tmp_verts, self.m.vert_normals = self.m.vert_normals, self.tmp_verts + * + */ + +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_37update_mesh_normals(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor); /*proto*/ +static void __pyx_f_14softwrap_core2_12SpringEngine_update_mesh_normals(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor, int __pyx_skip_dispatch) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + vec3 *__pyx_t_6; + vec3 *__pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_mesh_normals", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update_mesh_normals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_14softwrap_core2_12SpringEngine_37update_mesh_normals)) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_factor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "core/core2.pyx":1550 + * + * cpdef void update_mesh_normals(self, float factor): + * self.tmp_verts, self.m.vert_normals = self.m.vert_normals, self.tmp_verts # <<<<<<<<<<<<<< + * + * self.m.update_face_normals() + */ + +# line 1550 "core/core2.pyx" + __pyx_t_6 = __pyx_v_self->m->vert_normals; + +# line 1550 "core/core2.pyx" + __pyx_t_7 = __pyx_v_self->tmp_verts; + +# line 1550 "core/core2.pyx" + __pyx_v_self->tmp_verts = __pyx_t_6; + +# line 1550 "core/core2.pyx" + __pyx_v_self->m->vert_normals = __pyx_t_7; + + /* "core/core2.pyx":1552 + * self.tmp_verts, self.m.vert_normals = self.m.vert_normals, self.tmp_verts + * + * self.m.update_face_normals() # <<<<<<<<<<<<<< + * self.m.update_vert_normals() + * + */ + +# line 1552 "core/core2.pyx" + __pyx_f_14softwrap_core2_4Mesh_update_face_normals(__pyx_v_self->m, 0); + + /* "core/core2.pyx":1553 + * + * self.m.update_face_normals() + * self.m.update_vert_normals() # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1553 "core/core2.pyx" + __pyx_f_14softwrap_core2_4Mesh_update_vert_normals(__pyx_v_self->m, 0); + + /* "core/core2.pyx":1556 + * + * cdef int i + * if factor < 1: # <<<<<<<<<<<<<< + * with nogil: + * for i in prange(self.n_verts): + */ + +# line 1556 "core/core2.pyx" + __pyx_t_8 = ((__pyx_v_factor < 1.0) != 0); + +# line 1556 "core/core2.pyx" + if (__pyx_t_8) { + + /* "core/core2.pyx":1557 + * cdef int i + * if factor < 1: + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * self.m.vert_normals[i] = self.tmp_verts[i].lerp(self.m.vert_normals[i], factor) + */ + +# line 1557 "core/core2.pyx" + { + +# line 1557 "core/core2.pyx" + #ifdef WITH_THREAD + +# line 1557 "core/core2.pyx" + PyThreadState *_save; + +# line 1557 "core/core2.pyx" + Py_UNBLOCK_THREADS + +# line 1557 "core/core2.pyx" + __Pyx_FastGIL_Remember(); + +# line 1557 "core/core2.pyx" + #endif + /*try:*/ { + + /* "core/core2.pyx":1558 + * if factor < 1: + * with nogil: + * for i in prange(self.n_verts): # <<<<<<<<<<<<<< + * self.m.vert_normals[i] = self.tmp_verts[i].lerp(self.m.vert_normals[i], factor) + */ + +# line 1558 "core/core2.pyx" + __pyx_t_9 = __pyx_v_self->n_verts; + +# line 1558 "core/core2.pyx" + if ((1 == 0)) abort(); + +# line 1558 "core/core2.pyx" + { + +# line 1558 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1558 "core/core2.pyx" + #undef likely + +# line 1558 "core/core2.pyx" + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + +# line 1558 "core/core2.pyx" + #endif + +# line 1558 "core/core2.pyx" + __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1; + +# line 1558 "core/core2.pyx" + if (__pyx_t_11 > 0) + +# line 1558 "core/core2.pyx" + { + +# line 1558 "core/core2.pyx" + #ifdef _OPENMP + +# line 1558 "core/core2.pyx" + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_10); + + /* "core/core2.pyx":1559 + * with nogil: + * for i in prange(self.n_verts): + * self.m.vert_normals[i] = self.tmp_verts[i].lerp(self.m.vert_normals[i], factor) # <<<<<<<<<<<<<< + */ + +# line 1559 "core/core2.pyx" + (__pyx_v_self->m->vert_normals[__pyx_v_i]) = (__pyx_v_self->tmp_verts[__pyx_v_i]).lerp((__pyx_v_self->m->vert_normals[__pyx_v_i]), __pyx_v_factor); + +# line 1559 "core/core2.pyx" + } + +# line 1559 "core/core2.pyx" + } + +# line 1559 "core/core2.pyx" + } + +# line 1559 "core/core2.pyx" + } + +# line 1559 "core/core2.pyx" + } + +# line 1559 "core/core2.pyx" + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + +# line 1559 "core/core2.pyx" + #undef likely + +# line 1559 "core/core2.pyx" + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + +# line 1559 "core/core2.pyx" + #endif + +# line 1559 "core/core2.pyx" + } + + /* "core/core2.pyx":1557 + * cdef int i + * if factor < 1: + * with nogil: # <<<<<<<<<<<<<< + * for i in prange(self.n_verts): + * self.m.vert_normals[i] = self.tmp_verts[i].lerp(self.m.vert_normals[i], factor) + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "core/core2.pyx":1556 + * + * cdef int i + * if factor < 1: # <<<<<<<<<<<<<< + * with nogil: + * for i in prange(self.n_verts): + */ + +# line 1556 "core/core2.pyx" + } + + /* "core/core2.pyx":1549 + * self.prev_verts, self.m.verts, self.tmp_verts = self.m.verts, self.tmp_verts, self.prev_verts + * + * cpdef void update_mesh_normals(self, float factor): # <<<<<<<<<<<<<< + * self.tmp_verts, self.m.vert_normals = self.m.vert_normals, self.tmp_verts + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("softwrap_core2.SpringEngine.update_mesh_normals", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_37update_mesh_normals(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_37update_mesh_normals(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor) { + float __pyx_v_factor; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update_mesh_normals (wrapper)", 0); + assert(__pyx_arg_factor); { + __pyx_v_factor = __pyx_PyFloat_AsFloat(__pyx_arg_factor); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1549, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("softwrap_core2.SpringEngine.update_mesh_normals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_36update_mesh_normals(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((float)__pyx_v_factor)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_36update_mesh_normals(struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, float __pyx_v_factor) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_mesh_normals", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_14softwrap_core2_12SpringEngine_update_mesh_normals(__pyx_v_self, __pyx_v_factor, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.update_mesh_normals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_39__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_39__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_38__reduce_cython__(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_38__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_41__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_14softwrap_core2_12SpringEngine_41__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_14softwrap_core2_12SpringEngine_40__setstate_cython__(((struct __pyx_obj_14softwrap_core2_SpringEngine *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_14softwrap_core2_12SpringEngine_40__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_14softwrap_core2_SpringEngine *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("softwrap_core2.SpringEngine.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "carray.from_py":77 + * + * @cname("__Pyx_carray_from_py_float") + * cdef int __Pyx_carray_from_py_float(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< + * cdef Py_ssize_t i = length + * try: + */ + +static int __Pyx_carray_from_py_float(PyObject *__pyx_v_o, float *__pyx_v_v, Py_ssize_t __pyx_v_length) { + Py_ssize_t __pyx_v_i; + PyObject *__pyx_v_item = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_10 = NULL; + float __pyx_t_11; + char const *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_carray_from_py_float", 0); + + /* "carray.from_py":78 + * @cname("__Pyx_carray_from_py_float") + * cdef int __Pyx_carray_from_py_float(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length # <<<<<<<<<<<<<< + * try: + * i = len(o) + */ + __pyx_v_i = __pyx_v_length; + + /* "carray.from_py":79 + * cdef int __Pyx_carray_from_py_float(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "carray.from_py":80 + * cdef Py_ssize_t i = length + * try: + * i = len(o) # <<<<<<<<<<<<<< + * except (TypeError, OverflowError): + * pass + */ + __pyx_t_4 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 80, __pyx_L3_error) + __pyx_v_i = __pyx_t_4; + + /* "carray.from_py":79 + * cdef int __Pyx_carray_from_py_float(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "carray.from_py":81 + * try: + * i = len(o) + * except (TypeError, OverflowError): # <<<<<<<<<<<<<< + * pass + * if i == length: + */ + __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError); + if (__pyx_t_5) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L4_exception_handled; + } + goto __pyx_L5_except_error; + __pyx_L5_except_error:; + + /* "carray.from_py":79 + * cdef int __Pyx_carray_from_py_float(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): + */ + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L8_try_end:; + } + + /* "carray.from_py":83 + * except (TypeError, OverflowError): + * pass + * if i == length: # <<<<<<<<<<<<<< + * for i, item in enumerate(o): + * if i >= length: + */ + __pyx_t_6 = ((__pyx_v_i == __pyx_v_length) != 0); + if (__pyx_t_6) { + + /* "carray.from_py":84 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break + */ + __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_7 = __pyx_v_o; __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 84, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error) + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error) + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } + } else { + __pyx_t_10 = __pyx_t_9(__pyx_t_7); + if (unlikely(!__pyx_t_10)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 84, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_10); + __pyx_t_10 = 0; + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = (__pyx_t_4 + 1); + + /* "carray.from_py":85 + * if i == length: + * for i, item in enumerate(o): + * if i >= length: # <<<<<<<<<<<<<< + * break + * v[i] = item + */ + __pyx_t_6 = ((__pyx_v_i >= __pyx_v_length) != 0); + if (__pyx_t_6) { + + /* "carray.from_py":86 + * for i, item in enumerate(o): + * if i >= length: + * break # <<<<<<<<<<<<<< + * v[i] = item + * else: + */ + goto __pyx_L11_break; + + /* "carray.from_py":85 + * if i == length: + * for i, item in enumerate(o): + * if i >= length: # <<<<<<<<<<<<<< + * break + * v[i] = item + */ + } + + /* "carray.from_py":87 + * if i >= length: + * break + * v[i] = item # <<<<<<<<<<<<<< + * else: + * i += 1 # convert index to length + */ + __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_item); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 87, __pyx_L1_error) + (__pyx_v_v[__pyx_v_i]) = __pyx_t_11; + + /* "carray.from_py":84 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break + */ + } + /*else*/ { + + /* "carray.from_py":89 + * v[i] = item + * else: + * i += 1 # convert index to length # <<<<<<<<<<<<<< + * if i == length: + * return 0 + */ + __pyx_v_i = (__pyx_v_i + 1); + + /* "carray.from_py":90 + * else: + * i += 1 # convert index to length + * if i == length: # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_6 = ((__pyx_v_i == __pyx_v_length) != 0); + if (__pyx_t_6) { + + /* "carray.from_py":91 + * i += 1 # convert index to length + * if i == length: + * return 0 # <<<<<<<<<<<<<< + * + * PyErr_Format( + */ + __pyx_r = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L0; + + /* "carray.from_py":90 + * else: + * i += 1 # convert index to length + * if i == length: # <<<<<<<<<<<<<< + * return 0 + * + */ + } + } + + /* "carray.from_py":84 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break + */ + __pyx_L11_break:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "carray.from_py":83 + * except (TypeError, OverflowError): + * pass + * if i == length: # <<<<<<<<<<<<<< + * for i, item in enumerate(o): + * if i >= length: + */ + } + + /* "carray.from_py":96 + * IndexError, + * ("too many values found during array assignment, expected %zd" + * if i >= length else # <<<<<<<<<<<<<< + * "not enough values found during array assignment, expected %zd, got %zd"), + * length, i) + */ + if (((__pyx_v_i >= __pyx_v_length) != 0)) { + __pyx_t_12 = ((char const *)"too many values found during array assignment, expected %zd"); + } else { + __pyx_t_12 = ((char const *)"not enough values found during array assignment, expected %zd, got %zd"); + } + + /* "carray.from_py":93 + * return 0 + * + * PyErr_Format( # <<<<<<<<<<<<<< + * IndexError, + * ("too many values found during array assignment, expected %zd" + */ + __pyx_t_7 = PyErr_Format(__pyx_builtin_IndexError, __pyx_t_12, __pyx_v_length, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "carray.from_py":77 + * + * @cname("__Pyx_carray_from_py_float") + * cdef int __Pyx_carray_from_py_float(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< + * cdef Py_ssize_t i = length + * try: + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("carray.from_py.__Pyx_carray_from_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __Pyx_carray_from_py_int(PyObject *__pyx_v_o, int *__pyx_v_v, Py_ssize_t __pyx_v_length) { + Py_ssize_t __pyx_v_i; + PyObject *__pyx_v_item = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_10 = NULL; + char const *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_carray_from_py_int", 0); + + /* "carray.from_py":78 + * @cname("__Pyx_carray_from_py_int") + * cdef int __Pyx_carray_from_py_int(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length # <<<<<<<<<<<<<< + * try: + * i = len(o) + */ + __pyx_v_i = __pyx_v_length; + + /* "carray.from_py":79 + * cdef int __Pyx_carray_from_py_int(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "carray.from_py":80 + * cdef Py_ssize_t i = length + * try: + * i = len(o) # <<<<<<<<<<<<<< + * except (TypeError, OverflowError): + * pass + */ + __pyx_t_4 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(1, 80, __pyx_L3_error) + __pyx_v_i = __pyx_t_4; + + /* "carray.from_py":79 + * cdef int __Pyx_carray_from_py_int(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "carray.from_py":81 + * try: + * i = len(o) + * except (TypeError, OverflowError): # <<<<<<<<<<<<<< + * pass + * if i == length: + */ + __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError); + if (__pyx_t_5) { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L4_exception_handled; + } + goto __pyx_L5_except_error; + __pyx_L5_except_error:; + + /* "carray.from_py":79 + * cdef int __Pyx_carray_from_py_int(object o, base_type *v, Py_ssize_t length) except -1: + * cdef Py_ssize_t i = length + * try: # <<<<<<<<<<<<<< + * i = len(o) + * except (TypeError, OverflowError): + */ + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L8_try_end:; + } + + /* "carray.from_py":83 + * except (TypeError, OverflowError): + * pass + * if i == length: # <<<<<<<<<<<<<< + * for i, item in enumerate(o): + * if i >= length: + */ + __pyx_t_6 = ((__pyx_v_i == __pyx_v_length) != 0); + if (__pyx_t_6) { + + /* "carray.from_py":84 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break + */ + __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_7 = __pyx_v_o; __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 84, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error) + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error) + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } + } else { + __pyx_t_10 = __pyx_t_9(__pyx_t_7); + if (unlikely(!__pyx_t_10)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 84, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_10); + __pyx_t_10 = 0; + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = (__pyx_t_4 + 1); + + /* "carray.from_py":85 + * if i == length: + * for i, item in enumerate(o): + * if i >= length: # <<<<<<<<<<<<<< + * break + * v[i] = item + */ + __pyx_t_6 = ((__pyx_v_i >= __pyx_v_length) != 0); + if (__pyx_t_6) { + + /* "carray.from_py":86 + * for i, item in enumerate(o): + * if i >= length: + * break # <<<<<<<<<<<<<< + * v[i] = item + * else: + */ + goto __pyx_L11_break; + + /* "carray.from_py":85 + * if i == length: + * for i, item in enumerate(o): + * if i >= length: # <<<<<<<<<<<<<< + * break + * v[i] = item + */ + } + + /* "carray.from_py":87 + * if i >= length: + * break + * v[i] = item # <<<<<<<<<<<<<< + * else: + * i += 1 # convert index to length + */ + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_item); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 87, __pyx_L1_error) + (__pyx_v_v[__pyx_v_i]) = __pyx_t_5; + + /* "carray.from_py":84 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break + */ + } + /*else*/ { + + /* "carray.from_py":89 + * v[i] = item + * else: + * i += 1 # convert index to length # <<<<<<<<<<<<<< + * if i == length: + * return 0 + */ + __pyx_v_i = (__pyx_v_i + 1); + + /* "carray.from_py":90 + * else: + * i += 1 # convert index to length + * if i == length: # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_6 = ((__pyx_v_i == __pyx_v_length) != 0); + if (__pyx_t_6) { + + /* "carray.from_py":91 + * i += 1 # convert index to length + * if i == length: + * return 0 # <<<<<<<<<<<<<< + * + * PyErr_Format( + */ + __pyx_r = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L0; + + /* "carray.from_py":90 + * else: + * i += 1 # convert index to length + * if i == length: # <<<<<<<<<<<<<< + * return 0 + * + */ + } + } + + /* "carray.from_py":84 + * pass + * if i == length: + * for i, item in enumerate(o): # <<<<<<<<<<<<<< + * if i >= length: + * break + */ + __pyx_L11_break:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "carray.from_py":83 + * except (TypeError, OverflowError): + * pass + * if i == length: # <<<<<<<<<<<<<< + * for i, item in enumerate(o): + * if i >= length: + */ + } + + /* "carray.from_py":96 + * IndexError, + * ("too many values found during array assignment, expected %zd" + * if i >= length else # <<<<<<<<<<<<<< + * "not enough values found during array assignment, expected %zd, got %zd"), + * length, i) + */ + if (((__pyx_v_i >= __pyx_v_length) != 0)) { + __pyx_t_11 = ((char const *)"too many values found during array assignment, expected %zd"); + } else { + __pyx_t_11 = ((char const *)"not enough values found during array assignment, expected %zd, got %zd"); + } + + /* "carray.from_py":93 + * return 0 + * + * PyErr_Format( # <<<<<<<<<<<<<< + * IndexError, + * ("too many values found during array assignment, expected %zd" + */ + __pyx_t_7 = PyErr_Format(__pyx_builtin_IndexError, __pyx_t_11, __pyx_v_length, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "carray.from_py":77 + * + * @cname("__Pyx_carray_from_py_int") + * cdef int __Pyx_carray_from_py_int(object o, base_type *v, Py_ssize_t length) except -1: # <<<<<<<<<<<<<< + * cdef Py_ssize_t i = length + * try: + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("carray.from_py.__Pyx_carray_from_py_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "carray.to_py":112 + * + * @cname("__Pyx_carray_to_py_float") + * cdef inline list __Pyx_carray_to_py_float(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef size_t i + * cdef object value + */ + +static CYTHON_INLINE PyObject *__Pyx_carray_to_py_float(float *__pyx_v_v, Py_ssize_t __pyx_v_length) { + size_t __pyx_v_i; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_l = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_carray_to_py_float", 0); + + /* "carray.to_py":115 + * cdef size_t i + * cdef object value + * l = PyList_New(length) # <<<<<<<<<<<<<< + * for i in range(length): + * value = v[i] + */ + __pyx_t_1 = PyList_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_l = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "carray.to_py":116 + * cdef object value + * l = PyList_New(length) + * for i in range(length): # <<<<<<<<<<<<<< + * value = v[i] + * Py_INCREF(value) + */ + __pyx_t_2 = ((size_t)__pyx_v_length); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "carray.to_py":117 + * l = PyList_New(length) + * for i in range(length): + * value = v[i] # <<<<<<<<<<<<<< + * Py_INCREF(value) + * PyList_SET_ITEM(l, i, value) + */ + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1); + __pyx_t_1 = 0; + + /* "carray.to_py":118 + * for i in range(length): + * value = v[i] + * Py_INCREF(value) # <<<<<<<<<<<<<< + * PyList_SET_ITEM(l, i, value) + * return l + */ + Py_INCREF(__pyx_v_value); + + /* "carray.to_py":119 + * value = v[i] + * Py_INCREF(value) + * PyList_SET_ITEM(l, i, value) # <<<<<<<<<<<<<< + * return l + * + */ + PyList_SET_ITEM(__pyx_v_l, __pyx_v_i, __pyx_v_value); + } + + /* "carray.to_py":120 + * Py_INCREF(value) + * PyList_SET_ITEM(l, i, value) + * return l # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_l); + __pyx_r = __pyx_v_l; + goto __pyx_L0; + + /* "carray.to_py":112 + * + * @cname("__Pyx_carray_to_py_float") + * cdef inline list __Pyx_carray_to_py_float(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef size_t i + * cdef object value + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_l); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "carray.to_py":124 + * + * @cname("__Pyx_carray_to_tuple_float") + * cdef inline tuple __Pyx_carray_to_tuple_float(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef size_t i + * cdef object value + */ + +static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_float(float *__pyx_v_v, Py_ssize_t __pyx_v_length) { + size_t __pyx_v_i; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_t = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_carray_to_tuple_float", 0); + + /* "carray.to_py":127 + * cdef size_t i + * cdef object value + * t = PyTuple_New(length) # <<<<<<<<<<<<<< + * for i in range(length): + * value = v[i] + */ + __pyx_t_1 = PyTuple_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_t = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "carray.to_py":128 + * cdef object value + * t = PyTuple_New(length) + * for i in range(length): # <<<<<<<<<<<<<< + * value = v[i] + * Py_INCREF(value) + */ + __pyx_t_2 = ((size_t)__pyx_v_length); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "carray.to_py":129 + * t = PyTuple_New(length) + * for i in range(length): + * value = v[i] # <<<<<<<<<<<<<< + * Py_INCREF(value) + * PyTuple_SET_ITEM(t, i, value) + */ + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1); + __pyx_t_1 = 0; + + /* "carray.to_py":130 + * for i in range(length): + * value = v[i] + * Py_INCREF(value) # <<<<<<<<<<<<<< + * PyTuple_SET_ITEM(t, i, value) + * return t + */ + Py_INCREF(__pyx_v_value); + + /* "carray.to_py":131 + * value = v[i] + * Py_INCREF(value) + * PyTuple_SET_ITEM(t, i, value) # <<<<<<<<<<<<<< + * return t + */ + PyTuple_SET_ITEM(__pyx_v_t, __pyx_v_i, __pyx_v_value); + } + + /* "carray.to_py":132 + * Py_INCREF(value) + * PyTuple_SET_ITEM(t, i, value) + * return t # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_t); + __pyx_r = __pyx_v_t; + goto __pyx_L0; + + /* "carray.to_py":124 + * + * @cname("__Pyx_carray_to_tuple_float") + * cdef inline tuple __Pyx_carray_to_tuple_float(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef size_t i + * cdef object value + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_tuple_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_14softwrap_core2_Mesh __pyx_vtable_14softwrap_core2_Mesh; + +static PyObject *__pyx_tp_new_14softwrap_core2_Mesh(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_14softwrap_core2_Mesh *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_Mesh *)o); + p->__pyx_vtab = __pyx_vtabptr_14softwrap_core2_Mesh; + return o; +} + +static void __pyx_tp_dealloc_14softwrap_core2_Mesh(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_14softwrap_core2_4Mesh_15__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_14softwrap_core2_Mesh[] = { + {"get_vert_normals", (PyCFunction)__pyx_pw_14softwrap_core2_4Mesh_1get_vert_normals, METH_NOARGS, 0}, + {"get_face_normals", (PyCFunction)__pyx_pw_14softwrap_core2_4Mesh_3get_face_normals, METH_NOARGS, 0}, + {"update_face_normals", (PyCFunction)__pyx_pw_14softwrap_core2_4Mesh_7update_face_normals, METH_NOARGS, 0}, + {"update_vert_normals", (PyCFunction)__pyx_pw_14softwrap_core2_4Mesh_9update_vert_normals, METH_NOARGS, 0}, + {"update_centroids", (PyCFunction)__pyx_pw_14softwrap_core2_4Mesh_11update_centroids, METH_NOARGS, 0}, + {"closest_vert", (PyCFunction)__pyx_pw_14softwrap_core2_4Mesh_13closest_vert, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_4Mesh_17__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_4Mesh_19__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_14softwrap_core2_Mesh = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.Mesh", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_Mesh), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_Mesh, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_Mesh, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_14softwrap_core2_4Mesh_5__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_Mesh, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; +static struct __pyx_vtabstruct_14softwrap_core2_BVH __pyx_vtable_14softwrap_core2_BVH; + +static PyObject *__pyx_tp_new_14softwrap_core2_BVH(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_14softwrap_core2_BVH *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_BVH *)o); + p->__pyx_vtab = __pyx_vtabptr_14softwrap_core2_BVH; + p->mesh = ((struct __pyx_obj_14softwrap_core2_Mesh *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_14softwrap_core2_3BVH_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_14softwrap_core2_BVH(PyObject *o) { + struct __pyx_obj_14softwrap_core2_BVH *p = (struct __pyx_obj_14softwrap_core2_BVH *)o; + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_14softwrap_core2_3BVH_3__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mesh); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2_BVH(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2_BVH *p = (struct __pyx_obj_14softwrap_core2_BVH *)o; + if (p->mesh) { + e = (*v)(((PyObject *)p->mesh), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2_BVH(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2_BVH *p = (struct __pyx_obj_14softwrap_core2_BVH *)o; + tmp = ((PyObject*)p->mesh); + p->mesh = ((struct __pyx_obj_14softwrap_core2_Mesh *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_14softwrap_core2_BVH[] = { + {"find_nearest", (PyCFunction)__pyx_pw_14softwrap_core2_3BVH_5find_nearest, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_3BVH_7__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_3BVH_9__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_14softwrap_core2_BVH = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.BVH", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_BVH), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_BVH, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2_BVH, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2_BVH, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_BVH, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_BVH, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static PyObject *__pyx_tp_new_14softwrap_core2_LinkProbe(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_14softwrap_core2_LinkProbe *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_LinkProbe *)o); + p->springs = ((struct __pyx_obj_14softwrap_core2_SpringLinks *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_14softwrap_core2_9LinkProbe_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_14softwrap_core2_LinkProbe(PyObject *o) { + struct __pyx_obj_14softwrap_core2_LinkProbe *p = (struct __pyx_obj_14softwrap_core2_LinkProbe *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->springs); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2_LinkProbe(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2_LinkProbe *p = (struct __pyx_obj_14softwrap_core2_LinkProbe *)o; + if (p->springs) { + e = (*v)(((PyObject *)p->springs), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2_LinkProbe(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2_LinkProbe *p = (struct __pyx_obj_14softwrap_core2_LinkProbe *)o; + tmp = ((PyObject*)p->springs); + p->springs = ((struct __pyx_obj_14softwrap_core2_SpringLinks *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_14softwrap_core2_LinkProbe(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_14softwrap_core2_9LinkProbe_avg_radius(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_9LinkProbe_10avg_radius_1__get__(o); +} + +static PyObject *__pyx_getprop_14softwrap_core2_9LinkProbe_springs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_9LinkProbe_7springs_1__get__(o); +} + +static PyObject *__pyx_getprop_14softwrap_core2_9LinkProbe_index(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_9LinkProbe_5index_1__get__(o); +} + +static PyMethodDef __pyx_methods_14softwrap_core2_LinkProbe[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_9LinkProbe_10__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_9LinkProbe_12__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_14softwrap_core2_LinkProbe[] = { + {(char *)"avg_radius", __pyx_getprop_14softwrap_core2_9LinkProbe_avg_radius, 0, (char *)0, 0}, + {(char *)"springs", __pyx_getprop_14softwrap_core2_9LinkProbe_springs, 0, (char *)0, 0}, + {(char *)"index", __pyx_getprop_14softwrap_core2_9LinkProbe_index, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_LinkProbe = { + __pyx_pw_14softwrap_core2_9LinkProbe_5__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_14softwrap_core2_LinkProbe, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_LinkProbe = { + __pyx_pw_14softwrap_core2_9LinkProbe_5__len__, /*mp_length*/ + __pyx_pw_14softwrap_core2_9LinkProbe_3__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_14softwrap_core2_LinkProbe = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.LinkProbe", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_LinkProbe), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_LinkProbe, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_LinkProbe, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_LinkProbe, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2_LinkProbe, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2_LinkProbe, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_14softwrap_core2_9LinkProbe_7__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_LinkProbe, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_14softwrap_core2_LinkProbe, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_LinkProbe, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; +static struct __pyx_vtabstruct_14softwrap_core2_SpringLinks __pyx_vtable_14softwrap_core2_SpringLinks; + +static PyObject *__pyx_tp_new_14softwrap_core2_SpringLinks(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_14softwrap_core2_SpringLinks *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_SpringLinks *)o); + p->__pyx_vtab = __pyx_vtabptr_14softwrap_core2_SpringLinks; + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_14softwrap_core2_11SpringLinks_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_14softwrap_core2_SpringLinks(PyObject *o) { + struct __pyx_obj_14softwrap_core2_SpringLinks *p = (struct __pyx_obj_14softwrap_core2_SpringLinks *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_14softwrap_core2_11SpringLinks_3__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->engine); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2_SpringLinks(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2_SpringLinks *p = (struct __pyx_obj_14softwrap_core2_SpringLinks *)o; + if (p->engine) { + e = (*v)(((PyObject *)p->engine), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2_SpringLinks(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2_SpringLinks *p = (struct __pyx_obj_14softwrap_core2_SpringLinks *)o; + tmp = ((PyObject*)p->engine); + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_14softwrap_core2_SpringLinks(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_14softwrap_core2_11SpringLinks_engine(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_11SpringLinks_6engine_1__get__(o); +} + +static PyMethodDef __pyx_methods_14softwrap_core2_SpringLinks[] = { + {"lengths_update", (PyCFunction)__pyx_pw_14softwrap_core2_11SpringLinks_7lengths_update, METH_NOARGS, 0}, + {"smooth", (PyCFunction)__pyx_pw_14softwrap_core2_11SpringLinks_9smooth, METH_O, 0}, + {"soft_spring_force", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_11SpringLinks_11soft_spring_force, METH_VARARGS|METH_KEYWORDS, 0}, + {"stiff_spring_force", (PyCFunction)__pyx_pw_14softwrap_core2_11SpringLinks_13stiff_spring_force, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_11SpringLinks_15__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_11SpringLinks_17__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_14softwrap_core2_SpringLinks[] = { + {(char *)"engine", __pyx_getprop_14softwrap_core2_11SpringLinks_engine, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_SpringLinks = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_14softwrap_core2_SpringLinks, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SpringLinks = { + 0, /*mp_length*/ + __pyx_pw_14softwrap_core2_11SpringLinks_5__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_14softwrap_core2_SpringLinks = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.SpringLinks", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_SpringLinks), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_SpringLinks, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_SpringLinks, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SpringLinks, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2_SpringLinks, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2_SpringLinks, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_SpringLinks, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_14softwrap_core2_SpringLinks, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_SpringLinks, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; +static struct __pyx_vtabstruct_14softwrap_core2_TernarySmoothingLinks __pyx_vtable_14softwrap_core2_TernarySmoothingLinks; + +static PyObject *__pyx_tp_new_14softwrap_core2_TernarySmoothingLinks(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)o); + p->__pyx_vtab = __pyx_vtabptr_14softwrap_core2_TernarySmoothingLinks; + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_14softwrap_core2_TernarySmoothingLinks(PyObject *o) { + struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *p = (struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)o; + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_14softwrap_core2_21TernarySmoothingLinks_3__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->engine); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2_TernarySmoothingLinks(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *p = (struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)o; + if (p->engine) { + e = (*v)(((PyObject *)p->engine), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2_TernarySmoothingLinks(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *p = (struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *)o; + tmp = ((PyObject*)p->engine); + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_14softwrap_core2_21TernarySmoothingLinks_engine(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_21TernarySmoothingLinks_6engine_1__get__(o); +} + +static PyMethodDef __pyx_methods_14softwrap_core2_TernarySmoothingLinks[] = { + {"displacements_update", (PyCFunction)__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_5displacements_update, METH_NOARGS, 0}, + {"displacement_force", (PyCFunction)__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_7displacement_force, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_9__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_21TernarySmoothingLinks_11__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_14softwrap_core2_TernarySmoothingLinks[] = { + {(char *)"engine", __pyx_getprop_14softwrap_core2_21TernarySmoothingLinks_engine, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_14softwrap_core2_TernarySmoothingLinks = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.TernarySmoothingLinks", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_TernarySmoothingLinks, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2_TernarySmoothingLinks, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2_TernarySmoothingLinks, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_TernarySmoothingLinks, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_14softwrap_core2_TernarySmoothingLinks, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_TernarySmoothingLinks, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; +static struct __pyx_vtabstruct_14softwrap_core2_QuaternarySmoothingLinks __pyx_vtable_14softwrap_core2_QuaternarySmoothingLinks; + +static PyObject *__pyx_tp_new_14softwrap_core2_QuaternarySmoothingLinks(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)o); + p->__pyx_vtab = __pyx_vtabptr_14softwrap_core2_QuaternarySmoothingLinks; + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_14softwrap_core2_QuaternarySmoothingLinks(PyObject *o) { + struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *p = (struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_3__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->engine); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2_QuaternarySmoothingLinks(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *p = (struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)o; + if (p->engine) { + e = (*v)(((PyObject *)p->engine), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2_QuaternarySmoothingLinks(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *p = (struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *)o; + tmp = ((PyObject*)p->engine); + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_14softwrap_core2_24QuaternarySmoothingLinks_engine(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_6engine_1__get__(o); +} + +static PyObject *__pyx_getprop_14softwrap_core2_24QuaternarySmoothingLinks_n_links(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_7n_links_1__get__(o); +} + +static PyMethodDef __pyx_methods_14softwrap_core2_QuaternarySmoothingLinks[] = { + {"lengths_update", (PyCFunction)__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_5lengths_update, METH_NOARGS, 0}, + {"smooth", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_7smooth, METH_VARARGS|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_9__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_24QuaternarySmoothingLinks_11__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_14softwrap_core2_QuaternarySmoothingLinks[] = { + {(char *)"engine", __pyx_getprop_14softwrap_core2_24QuaternarySmoothingLinks_engine, 0, (char *)0, 0}, + {(char *)"n_links", __pyx_getprop_14softwrap_core2_24QuaternarySmoothingLinks_n_links, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_14softwrap_core2_QuaternarySmoothingLinks = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.QuaternarySmoothingLinks", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_QuaternarySmoothingLinks, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2_QuaternarySmoothingLinks, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2_QuaternarySmoothingLinks, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_QuaternarySmoothingLinks, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_14softwrap_core2_QuaternarySmoothingLinks, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_QuaternarySmoothingLinks, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static PyObject *__pyx_tp_new_14softwrap_core2_SpringEnginePin(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_14softwrap_core2_SpringEnginePin *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)o); + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_14softwrap_core2_15SpringEnginePin_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_14softwrap_core2_SpringEnginePin(PyObject *o) { + struct __pyx_obj_14softwrap_core2_SpringEnginePin *p = (struct __pyx_obj_14softwrap_core2_SpringEnginePin *)o; + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_14softwrap_core2_15SpringEnginePin_10__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->engine); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2_SpringEnginePin(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2_SpringEnginePin *p = (struct __pyx_obj_14softwrap_core2_SpringEnginePin *)o; + if (p->engine) { + e = (*v)(((PyObject *)p->engine), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2_SpringEnginePin(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2_SpringEnginePin *p = (struct __pyx_obj_14softwrap_core2_SpringEnginePin *)o; + tmp = ((PyObject*)p->engine); + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_14softwrap_core2_SpringEnginePin(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_14softwrap_core2_15SpringEnginePin_engine(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_15SpringEnginePin_6engine_1__get__(o); +} + +static PyObject *__pyx_getprop_14softwrap_core2_15SpringEnginePin_n_rings(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_15SpringEnginePin_7n_rings_1__get__(o); +} + +static PyObject *__pyx_getprop_14softwrap_core2_15SpringEnginePin_start_index(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_15SpringEnginePin_11start_index_1__get__(o); +} + +static PyMethodDef __pyx_methods_14softwrap_core2_SpringEnginePin[] = { + {"move", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_15SpringEnginePin_8move, METH_VARARGS|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_15SpringEnginePin_12__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_15SpringEnginePin_14__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_14softwrap_core2_SpringEnginePin[] = { + {(char *)"engine", __pyx_getprop_14softwrap_core2_15SpringEnginePin_engine, 0, (char *)0, 0}, + {(char *)"n_rings", __pyx_getprop_14softwrap_core2_15SpringEnginePin_n_rings, 0, (char *)0, 0}, + {(char *)"start_index", __pyx_getprop_14softwrap_core2_15SpringEnginePin_start_index, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_SpringEnginePin = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_14softwrap_core2_SpringEnginePin, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SpringEnginePin = { + 0, /*mp_length*/ + __pyx_pw_14softwrap_core2_15SpringEnginePin_3__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_14softwrap_core2_SpringEnginePin = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.SpringEnginePin", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_SpringEnginePin), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_SpringEnginePin, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_SpringEnginePin, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SpringEnginePin, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2_SpringEnginePin, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2_SpringEnginePin, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_14softwrap_core2_15SpringEnginePin_5__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_SpringEnginePin, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_14softwrap_core2_SpringEnginePin, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_SpringEnginePin, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static PyObject *__pyx_tp_new_14softwrap_core2__MaskContextManager(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_14softwrap_core2__MaskContextManager *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2__MaskContextManager *)o); + p->mask = ((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_14softwrap_core2_19_MaskContextManager_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_14softwrap_core2__MaskContextManager(PyObject *o) { + struct __pyx_obj_14softwrap_core2__MaskContextManager *p = (struct __pyx_obj_14softwrap_core2__MaskContextManager *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->mask); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2__MaskContextManager(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2__MaskContextManager *p = (struct __pyx_obj_14softwrap_core2__MaskContextManager *)o; + if (p->mask) { + e = (*v)(((PyObject *)p->mask), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2__MaskContextManager(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2__MaskContextManager *p = (struct __pyx_obj_14softwrap_core2__MaskContextManager *)o; + tmp = ((PyObject*)p->mask); + p->mask = ((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_14softwrap_core2__MaskContextManager[] = { + {"__enter__", (PyCFunction)__pyx_pw_14softwrap_core2_19_MaskContextManager_3__enter__, METH_NOARGS, 0}, + {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_19_MaskContextManager_5__exit__, METH_VARARGS|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_19_MaskContextManager_7__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_19_MaskContextManager_9__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_14softwrap_core2__MaskContextManager = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2._MaskContextManager", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2__MaskContextManager), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2__MaskContextManager, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2__MaskContextManager, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2__MaskContextManager, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2__MaskContextManager, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2__MaskContextManager, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; +static struct __pyx_vtabstruct_14softwrap_core2_SpringEngineMask __pyx_vtable_14softwrap_core2_SpringEngineMask; + +static PyObject *__pyx_tp_new_14softwrap_core2_SpringEngineMask(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_14softwrap_core2_SpringEngineMask *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_SpringEngineMask *)o); + p->__pyx_vtab = __pyx_vtabptr_14softwrap_core2_SpringEngineMask; + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_14softwrap_core2_16SpringEngineMask_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_14softwrap_core2_SpringEngineMask(PyObject *o) { + struct __pyx_obj_14softwrap_core2_SpringEngineMask *p = (struct __pyx_obj_14softwrap_core2_SpringEngineMask *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_14softwrap_core2_16SpringEngineMask_19__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->engine); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2_SpringEngineMask(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2_SpringEngineMask *p = (struct __pyx_obj_14softwrap_core2_SpringEngineMask *)o; + if (p->engine) { + e = (*v)(((PyObject *)p->engine), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2_SpringEngineMask(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2_SpringEngineMask *p = (struct __pyx_obj_14softwrap_core2_SpringEngineMask *)o; + tmp = ((PyObject*)p->engine); + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_14softwrap_core2_SpringEngineMask(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_14softwrap_core2_SpringEngineMask(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_14softwrap_core2_16SpringEngineMask_5__setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyMethodDef __pyx_methods_14softwrap_core2_SpringEngineMask[] = { + {"set_force", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_16SpringEngineMask_7set_force, METH_VARARGS|METH_KEYWORDS, 0}, + {"load", (PyCFunction)__pyx_pw_14softwrap_core2_16SpringEngineMask_9load, METH_NOARGS, 0}, + {"store", (PyCFunction)__pyx_pw_14softwrap_core2_16SpringEngineMask_11store, METH_NOARGS, 0}, + {"masked_store", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_16SpringEngineMask_13masked_store, METH_VARARGS|METH_KEYWORDS, 0}, + {"set", (PyCFunction)__pyx_pw_14softwrap_core2_16SpringEngineMask_15set, METH_O, 0}, + {"masked_context", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_16SpringEngineMask_17masked_context, METH_VARARGS|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_16SpringEngineMask_21__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_16SpringEngineMask_23__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_SpringEngineMask = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_14softwrap_core2_SpringEngineMask, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SpringEngineMask = { + 0, /*mp_length*/ + __pyx_pw_14softwrap_core2_16SpringEngineMask_3__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_14softwrap_core2_SpringEngineMask, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_14softwrap_core2_SpringEngineMask = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.SpringEngineMask", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_SpringEngineMask), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_SpringEngineMask, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_SpringEngineMask, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SpringEngineMask, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2_SpringEngineMask, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2_SpringEngineMask, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_SpringEngineMask, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_SpringEngineMask, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; +static struct __pyx_vtabstruct_14softwrap_core2_SymmetryMap __pyx_vtable_14softwrap_core2_SymmetryMap; + +static PyObject *__pyx_tp_new_14softwrap_core2_SymmetryMap(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_14softwrap_core2_SymmetryMap *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_SymmetryMap *)o); + p->__pyx_vtab = __pyx_vtabptr_14softwrap_core2_SymmetryMap; + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_14softwrap_core2_11SymmetryMap_1__cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_14softwrap_core2_SymmetryMap(PyObject *o) { + struct __pyx_obj_14softwrap_core2_SymmetryMap *p = (struct __pyx_obj_14softwrap_core2_SymmetryMap *)o; + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_14softwrap_core2_11SymmetryMap_7__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->engine); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2_SymmetryMap(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2_SymmetryMap *p = (struct __pyx_obj_14softwrap_core2_SymmetryMap *)o; + if (p->engine) { + e = (*v)(((PyObject *)p->engine), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2_SymmetryMap(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2_SymmetryMap *p = (struct __pyx_obj_14softwrap_core2_SymmetryMap *)o; + tmp = ((PyObject*)p->engine); + p->engine = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_14softwrap_core2_SymmetryMap(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_14softwrap_core2_11SymmetryMap_error(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_14softwrap_core2_11SymmetryMap_5error_1__get__(o); +} + +static PyMethodDef __pyx_methods_14softwrap_core2_SymmetryMap[] = { + {"mirror", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_11SymmetryMap_5mirror, METH_VARARGS|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_11SymmetryMap_9__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_11SymmetryMap_11__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_14softwrap_core2_SymmetryMap[] = { + {(char *)"error", __pyx_getprop_14softwrap_core2_11SymmetryMap_error, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_SymmetryMap = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_14softwrap_core2_SymmetryMap, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SymmetryMap = { + 0, /*mp_length*/ + __pyx_pw_14softwrap_core2_11SymmetryMap_3__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_14softwrap_core2_SymmetryMap = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.SymmetryMap", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_SymmetryMap), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_SymmetryMap, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_SymmetryMap, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SymmetryMap, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2_SymmetryMap, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2_SymmetryMap, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_SymmetryMap, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_14softwrap_core2_SymmetryMap, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_SymmetryMap, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; +static struct __pyx_vtabstruct_14softwrap_core2_SpringEngine __pyx_vtable_14softwrap_core2_SpringEngine; + +static PyObject *__pyx_tp_new_14softwrap_core2_SpringEngine(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_14softwrap_core2_SpringEngine *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_14softwrap_core2_SpringEngine *)o); + p->__pyx_vtab = __pyx_vtabptr_14softwrap_core2_SpringEngine; + p->m = ((struct __pyx_obj_14softwrap_core2_Mesh *)Py_None); Py_INCREF(Py_None); + p->bvh = ((struct __pyx_obj_14softwrap_core2_BVH *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_14softwrap_core2_SpringEngine(PyObject *o) { + struct __pyx_obj_14softwrap_core2_SpringEngine *p = (struct __pyx_obj_14softwrap_core2_SpringEngine *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_pw_14softwrap_core2_12SpringEngine_5__dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->m); + Py_CLEAR(p->bvh); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_14softwrap_core2_SpringEngine(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2_SpringEngine *p = (struct __pyx_obj_14softwrap_core2_SpringEngine *)o; + if (p->m) { + e = (*v)(((PyObject *)p->m), a); if (e) return e; + } + if (p->bvh) { + e = (*v)(((PyObject *)p->bvh), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2_SpringEngine(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2_SpringEngine *p = (struct __pyx_obj_14softwrap_core2_SpringEngine *)o; + tmp = ((PyObject*)p->m); + p->m = ((struct __pyx_obj_14softwrap_core2_Mesh *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->bvh); + p->bvh = ((struct __pyx_obj_14softwrap_core2_BVH *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_14softwrap_core2_SpringEngine(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_14softwrap_core2_SpringEngine(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_14softwrap_core2_12SpringEngine_11__setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyMethodDef __pyx_methods_14softwrap_core2_SpringEngine[] = { + {"set_bvh", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_3set_bvh, METH_O, 0}, + {"from_list", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_13from_list, METH_O, 0}, + {"set_verts", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_12SpringEngine_15set_verts, METH_VARARGS|METH_KEYWORDS, 0}, + {"get_verts", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_17get_verts, METH_O, 0}, + {"move_verts", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_12SpringEngine_19move_verts, METH_VARARGS|METH_KEYWORDS, 0}, + {"snap_to_bvh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_12SpringEngine_21snap_to_bvh, METH_VARARGS|METH_KEYWORDS, 0}, + {"create_spring_group", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_23create_spring_group, METH_O, 0}, + {"create_symmetry_map", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_25create_symmetry_map, METH_NOARGS, 0}, + {"create_ternary_links", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_27create_ternary_links, METH_O, 0}, + {"create_quaternary_links", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_29create_quaternary_links, METH_O, 0}, + {"create_mask", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_31create_mask, METH_O, 0}, + {"random_verts", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_12SpringEngine_33random_verts, METH_VARARGS|METH_KEYWORDS, 0}, + {"kinetic_step", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_35kinetic_step, METH_O, 0}, + {"update_mesh_normals", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_37update_mesh_normals, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_39__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_14softwrap_core2_12SpringEngine_41__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_SpringEngine = { + __pyx_pw_14softwrap_core2_12SpringEngine_7__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_14softwrap_core2_SpringEngine, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SpringEngine = { + __pyx_pw_14softwrap_core2_12SpringEngine_7__len__, /*mp_length*/ + __pyx_pw_14softwrap_core2_12SpringEngine_9__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_14softwrap_core2_SpringEngine, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_14softwrap_core2_SpringEngine = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.SpringEngine", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2_SpringEngine), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2_SpringEngine, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_SpringEngine, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SpringEngine, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2_SpringEngine, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2_SpringEngine, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_14softwrap_core2_SpringEngine, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_14softwrap_core2_12SpringEngine_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2_SpringEngine, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *__pyx_freelist_14softwrap_core2___pyx_scope_struct____iter__[8]; +static int __pyx_freecount_14softwrap_core2___pyx_scope_struct____iter__ = 0; + +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_14softwrap_core2___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__)))) { + o = (PyObject*)__pyx_freelist_14softwrap_core2___pyx_scope_struct____iter__[--__pyx_freecount_14softwrap_core2___pyx_scope_struct____iter__]; + memset(o, 0, sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct____iter__(PyObject *o) { + struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_14softwrap_core2___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__)))) { + __pyx_freelist_14softwrap_core2___pyx_scope_struct____iter__[__pyx_freecount_14softwrap_core2___pyx_scope_struct____iter__++] = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__ *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static PyTypeObject __pyx_type_14softwrap_core2___pyx_scope_struct____iter__ = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.__pyx_scope_struct____iter__", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct____iter__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct____iter__, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct____iter__, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2___pyx_scope_struct____iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *__pyx_freelist_14softwrap_core2___pyx_scope_struct_1___getitem__[8]; +static int __pyx_freecount_14softwrap_core2___pyx_scope_struct_1___getitem__ = 0; + +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_1___getitem__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_14softwrap_core2___pyx_scope_struct_1___getitem__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__)))) { + o = (PyObject*)__pyx_freelist_14softwrap_core2___pyx_scope_struct_1___getitem__[--__pyx_freecount_14softwrap_core2___pyx_scope_struct_1___getitem__]; + memset(o, 0, sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_1___getitem__(PyObject *o) { + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_14softwrap_core2___pyx_scope_struct_1___getitem__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__)))) { + __pyx_freelist_14softwrap_core2___pyx_scope_struct_1___getitem__[__pyx_freecount_14softwrap_core2___pyx_scope_struct_1___getitem__++] = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_1___getitem__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2___pyx_scope_struct_1___getitem__(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__ *)o; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_14softwrap_core2_SpringEnginePin *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyTypeObject __pyx_type_14softwrap_core2___pyx_scope_struct_1___getitem__ = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.__pyx_scope_struct_1___getitem__", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_1___getitem__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_1___getitem__, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_1___getitem__, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2___pyx_scope_struct_1___getitem__, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2___pyx_scope_struct_1___getitem__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *__pyx_freelist_14softwrap_core2___pyx_scope_struct_2_iter_ring[8]; +static int __pyx_freecount_14softwrap_core2___pyx_scope_struct_2_iter_ring = 0; + +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_2_iter_ring(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_14softwrap_core2___pyx_scope_struct_2_iter_ring > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring)))) { + o = (PyObject*)__pyx_freelist_14softwrap_core2___pyx_scope_struct_2_iter_ring[--__pyx_freecount_14softwrap_core2___pyx_scope_struct_2_iter_ring]; + memset(o, 0, sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_2_iter_ring(PyObject *o) { + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_14softwrap_core2___pyx_scope_struct_2_iter_ring < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring)))) { + __pyx_freelist_14softwrap_core2___pyx_scope_struct_2_iter_ring[__pyx_freecount_14softwrap_core2___pyx_scope_struct_2_iter_ring++] = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_2_iter_ring(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; + } + return 0; +} + +static PyTypeObject __pyx_type_14softwrap_core2___pyx_scope_struct_2_iter_ring = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.__pyx_scope_struct_2_iter_ring", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_2_iter_ring), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_2_iter_ring, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_2_iter_ring, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2___pyx_scope_struct_2_iter_ring, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *__pyx_freelist_14softwrap_core2___pyx_scope_struct_3___iter__[8]; +static int __pyx_freecount_14softwrap_core2___pyx_scope_struct_3___iter__ = 0; + +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_3___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_14softwrap_core2___pyx_scope_struct_3___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__)))) { + o = (PyObject*)__pyx_freelist_14softwrap_core2___pyx_scope_struct_3___iter__[--__pyx_freecount_14softwrap_core2___pyx_scope_struct_3___iter__]; + memset(o, 0, sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_3___iter__(PyObject *o) { + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_14softwrap_core2___pyx_scope_struct_3___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__)))) { + __pyx_freelist_14softwrap_core2___pyx_scope_struct_3___iter__[__pyx_freecount_14softwrap_core2___pyx_scope_struct_3___iter__++] = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_3___iter__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__ *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static PyTypeObject __pyx_type_14softwrap_core2___pyx_scope_struct_3___iter__ = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.__pyx_scope_struct_3___iter__", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_3___iter__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_3___iter__, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_3___iter__, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2___pyx_scope_struct_3___iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *__pyx_freelist_14softwrap_core2___pyx_scope_struct_4___getitem__[8]; +static int __pyx_freecount_14softwrap_core2___pyx_scope_struct_4___getitem__ = 0; + +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_4___getitem__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_14softwrap_core2___pyx_scope_struct_4___getitem__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__)))) { + o = (PyObject*)__pyx_freelist_14softwrap_core2___pyx_scope_struct_4___getitem__[--__pyx_freecount_14softwrap_core2___pyx_scope_struct_4___getitem__]; + memset(o, 0, sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_4___getitem__(PyObject *o) { + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_14softwrap_core2___pyx_scope_struct_4___getitem__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__)))) { + __pyx_freelist_14softwrap_core2___pyx_scope_struct_4___getitem__[__pyx_freecount_14softwrap_core2___pyx_scope_struct_4___getitem__++] = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_4___getitem__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_14softwrap_core2___pyx_scope_struct_4___getitem__(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__ *)o; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_14softwrap_core2_SymmetryMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyTypeObject __pyx_type_14softwrap_core2___pyx_scope_struct_4___getitem__ = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.__pyx_scope_struct_4___getitem__", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_4___getitem__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_4___getitem__, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_4___getitem__, /*tp_traverse*/ + __pyx_tp_clear_14softwrap_core2___pyx_scope_struct_4___getitem__, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2___pyx_scope_struct_4___getitem__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *__pyx_freelist_14softwrap_core2___pyx_scope_struct_5_genexpr[8]; +static int __pyx_freecount_14softwrap_core2___pyx_scope_struct_5_genexpr = 0; + +static PyObject *__pyx_tp_new_14softwrap_core2___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_14softwrap_core2___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr)))) { + o = (PyObject*)__pyx_freelist_14softwrap_core2___pyx_scope_struct_5_genexpr[--__pyx_freecount_14softwrap_core2___pyx_scope_struct_5_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr)); + (void) PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_5_genexpr(PyObject *o) { + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_axis); + if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_14softwrap_core2___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr)))) { + __pyx_freelist_14softwrap_core2___pyx_scope_struct_5_genexpr[__pyx_freecount_14softwrap_core2___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_axis) { + e = (*v)(p->__pyx_v_axis, a); if (e) return e; + } + return 0; +} + +static PyTypeObject __pyx_type_14softwrap_core2___pyx_scope_struct_5_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "softwrap_core2.__pyx_scope_struct_5_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_14softwrap_core2___pyx_scope_struct_5_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_14softwrap_core2___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_14softwrap_core2___pyx_scope_struct_5_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_14softwrap_core2___pyx_scope_struct_5_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, /*tp_pypy_flags*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {"index_check", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14softwrap_core2_3index_check, METH_VARARGS|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_softwrap_core2(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_softwrap_core2}, + {0, NULL} +}; +#endif + +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + "softwrap_core2", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_BVH, __pyx_k_BVH, sizeof(__pyx_k_BVH), 0, 0, 1, 1}, + {&__pyx_n_u_INSIDE, __pyx_k_INSIDE, sizeof(__pyx_k_INSIDE), 0, 1, 0, 1}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_u_Invalid_or_empty_mesh, __pyx_k_Invalid_or_empty_mesh, sizeof(__pyx_k_Invalid_or_empty_mesh), 0, 1, 0, 0}, + {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, + {&__pyx_n_s_LinkProbe, __pyx_k_LinkProbe, sizeof(__pyx_k_LinkProbe), 0, 0, 1, 1}, + {&__pyx_n_s_LinkProbe___iter, __pyx_k_LinkProbe___iter, sizeof(__pyx_k_LinkProbe___iter), 0, 0, 1, 1}, + {&__pyx_n_s_MaskContextManager, __pyx_k_MaskContextManager, sizeof(__pyx_k_MaskContextManager), 0, 0, 1, 1}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_n_s_Mesh, __pyx_k_Mesh, sizeof(__pyx_k_Mesh), 0, 0, 1, 1}, + {&__pyx_kp_u_No_bvh_avaliable, __pyx_k_No_bvh_avaliable, sizeof(__pyx_k_No_bvh_avaliable), 0, 1, 0, 0}, + {&__pyx_n_u_OUTSIDE, __pyx_k_OUTSIDE, sizeof(__pyx_k_OUTSIDE), 0, 1, 0, 1}, + {&__pyx_kp_u_Oops_Softwrap2_memory_leak_dete, __pyx_k_Oops_Softwrap2_memory_leak_dete, sizeof(__pyx_k_Oops_Softwrap2_memory_leak_dete), 0, 1, 0, 0}, + {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1}, + {&__pyx_n_s_QuaternarySmoothingLinks, __pyx_k_QuaternarySmoothingLinks, sizeof(__pyx_k_QuaternarySmoothingLinks), 0, 0, 1, 1}, + {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_u_SURFACE, __pyx_k_SURFACE, sizeof(__pyx_k_SURFACE), 0, 1, 0, 1}, + {&__pyx_n_s_SpringEngine, __pyx_k_SpringEngine, sizeof(__pyx_k_SpringEngine), 0, 0, 1, 1}, + {&__pyx_n_s_SpringEngineMask, __pyx_k_SpringEngineMask, sizeof(__pyx_k_SpringEngineMask), 0, 0, 1, 1}, + {&__pyx_n_s_SpringEnginePin, __pyx_k_SpringEnginePin, sizeof(__pyx_k_SpringEnginePin), 0, 0, 1, 1}, + {&__pyx_n_s_SpringEnginePin___iter, __pyx_k_SpringEnginePin___iter, sizeof(__pyx_k_SpringEnginePin___iter), 0, 0, 1, 1}, + {&__pyx_n_s_SpringLinks, __pyx_k_SpringLinks, sizeof(__pyx_k_SpringLinks), 0, 0, 1, 1}, + {&__pyx_n_s_SymmetryMap, __pyx_k_SymmetryMap, sizeof(__pyx_k_SymmetryMap), 0, 0, 1, 1}, + {&__pyx_n_s_TernarySmoothingLinks, __pyx_k_TernarySmoothingLinks, sizeof(__pyx_k_TernarySmoothingLinks), 0, 0, 1, 1}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, + {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, + {&__pyx_n_s_atexit, __pyx_k_atexit, sizeof(__pyx_k_atexit), 0, 0, 1, 1}, + {&__pyx_n_s_bvh, __pyx_k_bvh, sizeof(__pyx_k_bvh), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, + {&__pyx_n_s_collect, __pyx_k_collect, sizeof(__pyx_k_collect), 0, 0, 1, 1}, + {&__pyx_kp_u_core2_pyx, __pyx_k_core2_pyx, sizeof(__pyx_k_core2_pyx), 0, 1, 0, 0}, + {&__pyx_kp_s_core_core2_pyx, __pyx_k_core_core2_pyx, sizeof(__pyx_k_core_core2_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_create_mask, __pyx_k_create_mask, sizeof(__pyx_k_create_mask), 0, 0, 1, 1}, + {&__pyx_n_s_create_quaternary_links, __pyx_k_create_quaternary_links, sizeof(__pyx_k_create_quaternary_links), 0, 0, 1, 1}, + {&__pyx_n_s_create_spring_group, __pyx_k_create_spring_group, sizeof(__pyx_k_create_spring_group), 0, 0, 1, 1}, + {&__pyx_n_s_create_symmetry_map, __pyx_k_create_symmetry_map, sizeof(__pyx_k_create_symmetry_map), 0, 0, 1, 1}, + {&__pyx_n_s_create_ternary_links, __pyx_k_create_ternary_links, sizeof(__pyx_k_create_ternary_links), 0, 0, 1, 1}, + {&__pyx_n_s_cycle_quality, __pyx_k_cycle_quality, sizeof(__pyx_k_cycle_quality), 0, 0, 1, 1}, + {&__pyx_n_s_deform_restore, __pyx_k_deform_restore, sizeof(__pyx_k_deform_restore), 0, 0, 1, 1}, + {&__pyx_n_s_deform_update, __pyx_k_deform_update, sizeof(__pyx_k_deform_update), 0, 0, 1, 1}, + {&__pyx_n_s_engine, __pyx_k_engine, sizeof(__pyx_k_engine), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_factor, __pyx_k_factor, sizeof(__pyx_k_factor), 0, 0, 1, 1}, + {&__pyx_n_s_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 0, 1, 1}, + {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1}, + {&__pyx_n_s_getitem___locals_genexpr, __pyx_k_getitem___locals_genexpr, sizeof(__pyx_k_getitem___locals_genexpr), 0, 0, 1, 1}, + {&__pyx_n_s_getitem___locals_iter_ring, __pyx_k_getitem___locals_iter_ring, sizeof(__pyx_k_getitem___locals_iter_ring), 0, 0, 1, 1}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_hex, __pyx_k_hex, sizeof(__pyx_k_hex), 0, 0, 1, 1}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_n_s_indexes, __pyx_k_indexes, sizeof(__pyx_k_indexes), 0, 0, 1, 1}, + {&__pyx_kp_u_indexes_array_is_not_the_same_si, __pyx_k_indexes_array_is_not_the_same_si, sizeof(__pyx_k_indexes_array_is_not_the_same_si), 0, 1, 0, 0}, + {&__pyx_kp_u_invalid_start_index, __pyx_k_invalid_start_index, sizeof(__pyx_k_invalid_start_index), 0, 1, 0, 0}, + {&__pyx_n_s_invert, __pyx_k_invert, sizeof(__pyx_k_invert), 0, 0, 1, 1}, + {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, + {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1}, + {&__pyx_n_s_iter_ring, __pyx_k_iter_ring, sizeof(__pyx_k_iter_ring), 0, 0, 1, 1}, + {&__pyx_n_s_kinetic_step, __pyx_k_kinetic_step, sizeof(__pyx_k_kinetic_step), 0, 0, 1, 1}, + {&__pyx_n_s_leak_check, __pyx_k_leak_check, sizeof(__pyx_k_leak_check), 0, 0, 1, 1}, + {&__pyx_n_s_lengths_update, __pyx_k_lengths_update, sizeof(__pyx_k_lengths_update), 0, 0, 1, 1}, + {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1}, + {&__pyx_n_s_links, __pyx_k_links, sizeof(__pyx_k_links), 0, 0, 1, 1}, + {&__pyx_kp_u_list_too_small, __pyx_k_list_too_small, sizeof(__pyx_k_list_too_small), 0, 1, 0, 0}, + {&__pyx_n_s_load, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1}, + {&__pyx_n_s_locations, __pyx_k_locations, sizeof(__pyx_k_locations), 0, 0, 1, 1}, + {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_mask, __pyx_k_mask, sizeof(__pyx_k_mask), 0, 0, 1, 1}, + {&__pyx_kp_u_mask_must_have_the_same_number_o, __pyx_k_mask_must_have_the_same_number_o, sizeof(__pyx_k_mask_must_have_the_same_number_o), 0, 1, 0, 0}, + {&__pyx_n_s_masked_store, __pyx_k_masked_store, sizeof(__pyx_k_masked_store), 0, 0, 1, 1}, + {&__pyx_n_s_max_deform, __pyx_k_max_deform, sizeof(__pyx_k_max_deform), 0, 0, 1, 1}, + {&__pyx_n_s_max_ratio, __pyx_k_max_ratio, sizeof(__pyx_k_max_ratio), 0, 0, 1, 1}, + {&__pyx_n_s_mesh, __pyx_k_mesh, sizeof(__pyx_k_mesh), 0, 0, 1, 1}, + {&__pyx_n_s_min_deform, __pyx_k_min_deform, sizeof(__pyx_k_min_deform), 0, 0, 1, 1}, + {&__pyx_n_s_n_rings, __pyx_k_n_rings, sizeof(__pyx_k_n_rings), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_kp_u_ptr, __pyx_k_ptr, sizeof(__pyx_k_ptr), 0, 1, 0, 0}, + {&__pyx_n_s_ptr_2, __pyx_k_ptr_2, sizeof(__pyx_k_ptr_2), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_random_verts, __pyx_k_random_verts, sizeof(__pyx_k_random_verts), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, + {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1}, + {&__pyx_n_s_seed, __pyx_k_seed, sizeof(__pyx_k_seed), 0, 0, 1, 1}, + {&__pyx_kp_s_self_bvh_closest_indexes_self_pr, __pyx_k_self_bvh_closest_indexes_self_pr, sizeof(__pyx_k_self_bvh_closest_indexes_self_pr), 0, 0, 1, 0}, + {&__pyx_kp_s_self_centroids_self_face_normals, __pyx_k_self_centroids_self_face_normals, sizeof(__pyx_k_self_centroids_self_face_normals), 0, 0, 1, 0}, + {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, + {&__pyx_n_s_set, __pyx_k_set, sizeof(__pyx_k_set), 0, 0, 1, 1}, + {&__pyx_n_s_set_bvh, __pyx_k_set_bvh, sizeof(__pyx_k_set_bvh), 0, 0, 1, 1}, + {&__pyx_n_s_set_force, __pyx_k_set_force, sizeof(__pyx_k_set_force), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_smooth, __pyx_k_smooth, sizeof(__pyx_k_smooth), 0, 0, 1, 1}, + {&__pyx_n_s_snapping_mode, __pyx_k_snapping_mode, sizeof(__pyx_k_snapping_mode), 0, 0, 1, 1}, + {&__pyx_n_s_soft_spring_force, __pyx_k_soft_spring_force, sizeof(__pyx_k_soft_spring_force), 0, 0, 1, 1}, + {&__pyx_n_s_softwrap_core2, __pyx_k_softwrap_core2, sizeof(__pyx_k_softwrap_core2), 0, 0, 1, 1}, + {&__pyx_n_s_springs, __pyx_k_springs, sizeof(__pyx_k_springs), 0, 0, 1, 1}, + {&__pyx_n_s_start_index, __pyx_k_start_index, sizeof(__pyx_k_start_index), 0, 0, 1, 1}, + {&__pyx_n_s_stiff_spring_force, __pyx_k_stiff_spring_force, sizeof(__pyx_k_stiff_spring_force), 0, 0, 1, 1}, + {&__pyx_n_s_store, __pyx_k_store, sizeof(__pyx_k_store), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, + {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_triangles, __pyx_k_triangles, sizeof(__pyx_k_triangles), 0, 0, 1, 1}, + {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1}, + {&__pyx_n_s_update_mesh_normals, __pyx_k_update_mesh_normals, sizeof(__pyx_k_update_mesh_normals), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_kp_u_vec_data_must_have_the_same_numb, __pyx_k_vec_data_must_have_the_same_numb, sizeof(__pyx_k_vec_data_must_have_the_same_numb), 0, 1, 0, 0}, + {&__pyx_n_s_verts, __pyx_k_verts, sizeof(__pyx_k_verts), 0, 0, 1, 1}, + {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, + {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, + {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 268, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_builtin_hex = __Pyx_GetBuiltinName(__pyx_n_s_hex); if (!__pyx_builtin_hex) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 302, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 323, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 1150, __pyx_L1_error) + __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 1350, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 1469, __pyx_L1_error) + __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(1, 81, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "core/core2.pyx":290 + * + * if not_freed_pointers: + * print('\n ------------ Oops Softwrap2 memory leak detected ------------ \n pointers not freed:') # <<<<<<<<<<<<<< + * for ptr, line in not_freed_pointers.items(): + * print(f' ptr: {hex(ptr)}, core2.pyx:{line}') + */ + +# line 290 "core/core2.pyx" + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Oops_Softwrap2_memory_leak_dete); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 290, __pyx_L1_error) + +# line 290 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple_); + +# line 290 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple_); + + /* "core/core2.pyx":293 + * for ptr, line in not_freed_pointers.items(): + * print(f' ptr: {hex(ptr)}, core2.pyx:{line}') + * print('\n -------------------------------------------------------------') # <<<<<<<<<<<<<< + * + * + */ + +# line 293 "core/core2.pyx" + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u__2); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 293, __pyx_L1_error) + +# line 293 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__3); + +# line 293 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__3); + + /* "core/core2.pyx":347 + * + * if len(verts) < 3 or len(triangles) < 1: + * raise ValueError('Invalid or empty mesh') # <<<<<<<<<<<<<< + * + * self.verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + */ + +# line 347 "core/core2.pyx" + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Invalid_or_empty_mesh); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 347, __pyx_L1_error) + +# line 347 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__4); + +# line 347 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + */ + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self_centroids_self_face_normals); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); + + /* "(tree fragment)":4 + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self.centroids,self.face_normals,self.triangles,self.vert_normals,self.verts cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_self_centroids_self_face_normals); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "core/core2.pyx":1120 + * + * if start_index < 0 or start_index >= self.engine.n_verts: + * raise ValueError('invalid start_index') # <<<<<<<<<<<<<< + * + * self.start_index = start_index + */ + +# line 1120 "core/core2.pyx" + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_invalid_start_index); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 1120, __pyx_L1_error) + +# line 1120 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__17); + +# line 1120 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__17); + + /* "core/core2.pyx":1161 + * raise IndexError + * + * def iter_ring(): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.rings[index][0]): + */ + +# line 1161 "core/core2.pyx" + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_i); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 1161, __pyx_L1_error) + +# line 1161 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__18); + +# line 1161 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__18); + +# line 1161 "core/core2.pyx" + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_core_core2_pyx, __pyx_n_s_iter_ring, 1161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 1161, __pyx_L1_error) + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + + /* "core/core2.pyx":1225 + * + * elif not len(mask) == engine.n_verts: + * raise ValueError('mask must have the same number of elements as engine verts') # <<<<<<<<<<<<<< + * + * self.mask = maelloc(sizeof(float) * self.engine.n_verts, __LINE__) + */ + +# line 1225 "core/core2.pyx" + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_mask_must_have_the_same_number_o); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 1225, __pyx_L1_error) + +# line 1225 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__24); + +# line 1225 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__24); + + /* "core/core2.pyx":1298 + * cdef int i + * if not len(vec_data) == self.engine.n_verts * 3: + * raise ValueError('vec_data must have the same number of elements as engine verts times 3') # <<<<<<<<<<<<<< + * + * for i in range(self.engine.n_verts * 3): + */ + +# line 1298 "core/core2.pyx" + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_u_vec_data_must_have_the_same_numb); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 1298, __pyx_L1_error) + +# line 1298 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__25); + +# line 1298 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__25); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + + /* "core/core2.pyx":1425 + * def from_list(self, list items): + * if not len(items) >= self.n_verts * 3: + * raise ValueError('list too small') # <<<<<<<<<<<<<< + * + * cdef int i + */ + +# line 1425 "core/core2.pyx" + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_u_list_too_small); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 1425, __pyx_L1_error) + +# line 1425 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__30); + +# line 1425 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__30); + + /* "core/core2.pyx":1436 + * cdef float x, y, z + * if not len(indexes) == len(locations): + * raise ValueError('indexes array is not the same size as locations array') # <<<<<<<<<<<<<< + * + * for i in range(len(indexes)): + */ + +# line 1436 "core/core2.pyx" + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_u_indexes_array_is_not_the_same_si); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1436, __pyx_L1_error) + +# line 1436 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__31); + +# line 1436 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__31); + + /* "core/core2.pyx":1469 + * + * if not self.bvh: + * raise RuntimeError('No bvh avaliable') # <<<<<<<<<<<<<< + * + * cycle_quality = nabs(cycle_quality) + */ + +# line 1469 "core/core2.pyx" + __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_u_No_bvh_avaliable); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1469, __pyx_L1_error) + +# line 1469 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__32); + +# line 1469 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__32); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + */ + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_self_bvh_closest_indexes_self_pr); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + + /* "(tree fragment)":4 + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self.bvh_closest_indexes,self.prev_verts,self.tmp_verts cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_self_bvh_closest_indexes_self_pr); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + + /* "core/core2.pyx":285 + * + * + * def leak_check(): # <<<<<<<<<<<<<< + * import gc + * gc.collect() + */ + +# line 285 "core/core2.pyx" + __pyx_tuple__35 = PyTuple_Pack(3, __pyx_n_s_gc, __pyx_n_s_ptr_2, __pyx_n_s_line); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 285, __pyx_L1_error) + +# line 285 "core/core2.pyx" + __Pyx_GOTREF(__pyx_tuple__35); + +# line 285 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_tuple__35); + +# line 285 "core/core2.pyx" + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_core_core2_pyx, __pyx_n_s_leak_check, 285, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 285, __pyx_L1_error) + +# line 285 "core/core2.pyx" + __Pyx_RefNannyFinishContext(); + +# line 285 "core/core2.pyx" + return 0; + +# line 285 "core/core2.pyx" + __pyx_L1_error:; + +# line 285 "core/core2.pyx" + __Pyx_RefNannyFinishContext(); + +# line 285 "core/core2.pyx" + return -1; + +# line 285 "core/core2.pyx" +} + + +# line 285 "core/core2.pyx" +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + /* InitThreads.init */ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 +PyEval_InitThreads(); +#endif + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __pyx_v_14softwrap_core2_not_freed_pointers = ((PyObject*)Py_None); Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_14softwrap_core2_Mesh = &__pyx_vtable_14softwrap_core2_Mesh; + __pyx_vtable_14softwrap_core2_Mesh.tri_vert_ptr = (vec3 *(*)(struct __pyx_obj_14softwrap_core2_Mesh *, int, int))__pyx_f_14softwrap_core2_4Mesh_tri_vert_ptr; + __pyx_vtable_14softwrap_core2_Mesh.tri_vert = (vec3 (*)(struct __pyx_obj_14softwrap_core2_Mesh *, int, int))__pyx_f_14softwrap_core2_4Mesh_tri_vert; + __pyx_vtable_14softwrap_core2_Mesh.update_face_normals = (void (*)(struct __pyx_obj_14softwrap_core2_Mesh *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_4Mesh_update_face_normals; + __pyx_vtable_14softwrap_core2_Mesh.update_vert_normals = (void (*)(struct __pyx_obj_14softwrap_core2_Mesh *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_4Mesh_update_vert_normals; + __pyx_vtable_14softwrap_core2_Mesh.update_centroids = (void (*)(struct __pyx_obj_14softwrap_core2_Mesh *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_4Mesh_update_centroids; + if (PyType_Ready(&__pyx_type_14softwrap_core2_Mesh) < 0) __PYX_ERR(0, 326, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_Mesh.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_Mesh.tp_dictoffset && __pyx_type_14softwrap_core2_Mesh.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_Mesh.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + if (__Pyx_SetVtable(__pyx_type_14softwrap_core2_Mesh.tp_dict, __pyx_vtabptr_14softwrap_core2_Mesh) < 0) __PYX_ERR(0, 326, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Mesh, (PyObject *)&__pyx_type_14softwrap_core2_Mesh) < 0) __PYX_ERR(0, 326, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_Mesh) < 0) __PYX_ERR(0, 326, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_Mesh = &__pyx_type_14softwrap_core2_Mesh; + __pyx_vtabptr_14softwrap_core2_BVH = &__pyx_vtable_14softwrap_core2_BVH; + __pyx_vtable_14softwrap_core2_BVH.pop_box = (BvhNodeBox *(*)(struct __pyx_obj_14softwrap_core2_BVH *))__pyx_f_14softwrap_core2_3BVH_pop_box; + __pyx_vtable_14softwrap_core2_BVH.build_tree = (union BvhNode *(*)(struct __pyx_obj_14softwrap_core2_BVH *, BvhNodeLeaf *, int))__pyx_f_14softwrap_core2_3BVH_build_tree; + __pyx_vtable_14softwrap_core2_BVH._find_nearest = (struct BvhNearestResult (*)(struct __pyx_obj_14softwrap_core2_BVH *, vec3))__pyx_f_14softwrap_core2_3BVH__find_nearest; + __pyx_vtable_14softwrap_core2_BVH.find_nearest_recursive = (void (*)(struct __pyx_obj_14softwrap_core2_BVH *, vec3 *, struct BvhNearestResult *, union BvhNode *))__pyx_f_14softwrap_core2_3BVH_find_nearest_recursive; + if (PyType_Ready(&__pyx_type_14softwrap_core2_BVH) < 0) __PYX_ERR(0, 554, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_BVH.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_BVH.tp_dictoffset && __pyx_type_14softwrap_core2_BVH.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_BVH.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + if (__Pyx_SetVtable(__pyx_type_14softwrap_core2_BVH.tp_dict, __pyx_vtabptr_14softwrap_core2_BVH) < 0) __PYX_ERR(0, 554, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BVH, (PyObject *)&__pyx_type_14softwrap_core2_BVH) < 0) __PYX_ERR(0, 554, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_BVH) < 0) __PYX_ERR(0, 554, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_BVH = &__pyx_type_14softwrap_core2_BVH; + if (PyType_Ready(&__pyx_type_14softwrap_core2_LinkProbe) < 0) __PYX_ERR(0, 712, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_LinkProbe.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_LinkProbe.tp_dictoffset && __pyx_type_14softwrap_core2_LinkProbe.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_LinkProbe.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_LinkProbe, (PyObject *)&__pyx_type_14softwrap_core2_LinkProbe) < 0) __PYX_ERR(0, 712, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_LinkProbe) < 0) __PYX_ERR(0, 712, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_LinkProbe = &__pyx_type_14softwrap_core2_LinkProbe; + __pyx_vtabptr_14softwrap_core2_SpringLinks = &__pyx_vtable_14softwrap_core2_SpringLinks; + __pyx_vtable_14softwrap_core2_SpringLinks.lengths_update = (void (*)(struct __pyx_obj_14softwrap_core2_SpringLinks *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_11SpringLinks_lengths_update; + __pyx_vtable_14softwrap_core2_SpringLinks.smooth = (void (*)(struct __pyx_obj_14softwrap_core2_SpringLinks *, float, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_11SpringLinks_smooth; + __pyx_vtable_14softwrap_core2_SpringLinks.soft_spring_force = (void (*)(struct __pyx_obj_14softwrap_core2_SpringLinks *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_11SpringLinks_soft_spring_force *__pyx_optional_args))__pyx_f_14softwrap_core2_11SpringLinks_soft_spring_force; + __pyx_vtable_14softwrap_core2_SpringLinks.stiff_spring_force = (void (*)(struct __pyx_obj_14softwrap_core2_SpringLinks *, float, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_11SpringLinks_stiff_spring_force; + if (PyType_Ready(&__pyx_type_14softwrap_core2_SpringLinks) < 0) __PYX_ERR(0, 747, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_SpringLinks.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_SpringLinks.tp_dictoffset && __pyx_type_14softwrap_core2_SpringLinks.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_SpringLinks.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_14softwrap_core2_SpringLinks.tp_dict, __pyx_vtabptr_14softwrap_core2_SpringLinks) < 0) __PYX_ERR(0, 747, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SpringLinks, (PyObject *)&__pyx_type_14softwrap_core2_SpringLinks) < 0) __PYX_ERR(0, 747, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_SpringLinks) < 0) __PYX_ERR(0, 747, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_SpringLinks = &__pyx_type_14softwrap_core2_SpringLinks; + __pyx_vtabptr_14softwrap_core2_TernarySmoothingLinks = &__pyx_vtable_14softwrap_core2_TernarySmoothingLinks; + __pyx_vtable_14softwrap_core2_TernarySmoothingLinks.displacements_update = (void (*)(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacements_update; + __pyx_vtable_14softwrap_core2_TernarySmoothingLinks.displacement_force = (void (*)(struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *, float, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_21TernarySmoothingLinks_displacement_force; + if (PyType_Ready(&__pyx_type_14softwrap_core2_TernarySmoothingLinks) < 0) __PYX_ERR(0, 915, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_TernarySmoothingLinks.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_TernarySmoothingLinks.tp_dictoffset && __pyx_type_14softwrap_core2_TernarySmoothingLinks.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_TernarySmoothingLinks.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + if (__Pyx_SetVtable(__pyx_type_14softwrap_core2_TernarySmoothingLinks.tp_dict, __pyx_vtabptr_14softwrap_core2_TernarySmoothingLinks) < 0) __PYX_ERR(0, 915, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TernarySmoothingLinks, (PyObject *)&__pyx_type_14softwrap_core2_TernarySmoothingLinks) < 0) __PYX_ERR(0, 915, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_TernarySmoothingLinks) < 0) __PYX_ERR(0, 915, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_TernarySmoothingLinks = &__pyx_type_14softwrap_core2_TernarySmoothingLinks; + __pyx_vtabptr_14softwrap_core2_QuaternarySmoothingLinks = &__pyx_vtable_14softwrap_core2_QuaternarySmoothingLinks; + __pyx_vtable_14softwrap_core2_QuaternarySmoothingLinks.lengths_update = (void (*)(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_24QuaternarySmoothingLinks_lengths_update; + __pyx_vtable_14softwrap_core2_QuaternarySmoothingLinks.smooth = (void (*)(struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_24QuaternarySmoothingLinks_smooth *__pyx_optional_args))__pyx_f_14softwrap_core2_24QuaternarySmoothingLinks_smooth; + if (PyType_Ready(&__pyx_type_14softwrap_core2_QuaternarySmoothingLinks) < 0) __PYX_ERR(0, 1017, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_QuaternarySmoothingLinks.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_QuaternarySmoothingLinks.tp_dictoffset && __pyx_type_14softwrap_core2_QuaternarySmoothingLinks.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_QuaternarySmoothingLinks.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_14softwrap_core2_QuaternarySmoothingLinks.tp_dict, __pyx_vtabptr_14softwrap_core2_QuaternarySmoothingLinks) < 0) __PYX_ERR(0, 1017, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_QuaternarySmoothingLinks, (PyObject *)&__pyx_type_14softwrap_core2_QuaternarySmoothingLinks) < 0) __PYX_ERR(0, 1017, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_QuaternarySmoothingLinks) < 0) __PYX_ERR(0, 1017, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_QuaternarySmoothingLinks = &__pyx_type_14softwrap_core2_QuaternarySmoothingLinks; + if (PyType_Ready(&__pyx_type_14softwrap_core2_SpringEnginePin) < 0) __PYX_ERR(0, 1108, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_SpringEnginePin.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_SpringEnginePin.tp_dictoffset && __pyx_type_14softwrap_core2_SpringEnginePin.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_SpringEnginePin.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SpringEnginePin, (PyObject *)&__pyx_type_14softwrap_core2_SpringEnginePin) < 0) __PYX_ERR(0, 1108, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_SpringEnginePin) < 0) __PYX_ERR(0, 1108, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_SpringEnginePin = &__pyx_type_14softwrap_core2_SpringEnginePin; + if (PyType_Ready(&__pyx_type_14softwrap_core2__MaskContextManager) < 0) __PYX_ERR(0, 1192, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2__MaskContextManager.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2__MaskContextManager.tp_dictoffset && __pyx_type_14softwrap_core2__MaskContextManager.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2__MaskContextManager.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_MaskContextManager, (PyObject *)&__pyx_type_14softwrap_core2__MaskContextManager) < 0) __PYX_ERR(0, 1192, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2__MaskContextManager) < 0) __PYX_ERR(0, 1192, __pyx_L1_error) + __pyx_ptype_14softwrap_core2__MaskContextManager = &__pyx_type_14softwrap_core2__MaskContextManager; + __pyx_vtabptr_14softwrap_core2_SpringEngineMask = &__pyx_vtable_14softwrap_core2_SpringEngineMask; + __pyx_vtable_14softwrap_core2_SpringEngineMask.set_force = (PyObject *(*)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, float, float, float, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_16SpringEngineMask_set_force; + __pyx_vtable_14softwrap_core2_SpringEngineMask.load = (void (*)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_16SpringEngineMask_load; + __pyx_vtable_14softwrap_core2_SpringEngineMask.store = (void (*)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_16SpringEngineMask_store; + __pyx_vtable_14softwrap_core2_SpringEngineMask.masked_store = (void (*)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_16SpringEngineMask_masked_store *__pyx_optional_args))__pyx_f_14softwrap_core2_16SpringEngineMask_masked_store; + __pyx_vtable_14softwrap_core2_SpringEngineMask.set = (PyObject *(*)(struct __pyx_obj_14softwrap_core2_SpringEngineMask *, PyObject *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_16SpringEngineMask_set; + if (PyType_Ready(&__pyx_type_14softwrap_core2_SpringEngineMask) < 0) __PYX_ERR(0, 1210, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_SpringEngineMask.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_SpringEngineMask.tp_dictoffset && __pyx_type_14softwrap_core2_SpringEngineMask.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_SpringEngineMask.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_14softwrap_core2_SpringEngineMask.tp_dict, __pyx_vtabptr_14softwrap_core2_SpringEngineMask) < 0) __PYX_ERR(0, 1210, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SpringEngineMask, (PyObject *)&__pyx_type_14softwrap_core2_SpringEngineMask) < 0) __PYX_ERR(0, 1210, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_SpringEngineMask) < 0) __PYX_ERR(0, 1210, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_SpringEngineMask = &__pyx_type_14softwrap_core2_SpringEngineMask; + __pyx_vtabptr_14softwrap_core2_SymmetryMap = &__pyx_vtable_14softwrap_core2_SymmetryMap; + __pyx_vtable_14softwrap_core2_SymmetryMap.mirror = (void (*)(struct __pyx_obj_14softwrap_core2_SymmetryMap *, int, int, int, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_11SymmetryMap_mirror; + if (PyType_Ready(&__pyx_type_14softwrap_core2_SymmetryMap) < 0) __PYX_ERR(0, 1313, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_SymmetryMap.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_SymmetryMap.tp_dictoffset && __pyx_type_14softwrap_core2_SymmetryMap.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_SymmetryMap.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + if (__Pyx_SetVtable(__pyx_type_14softwrap_core2_SymmetryMap.tp_dict, __pyx_vtabptr_14softwrap_core2_SymmetryMap) < 0) __PYX_ERR(0, 1313, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SymmetryMap, (PyObject *)&__pyx_type_14softwrap_core2_SymmetryMap) < 0) __PYX_ERR(0, 1313, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_SymmetryMap) < 0) __PYX_ERR(0, 1313, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_SymmetryMap = &__pyx_type_14softwrap_core2_SymmetryMap; + __pyx_vtabptr_14softwrap_core2_SpringEngine = &__pyx_vtable_14softwrap_core2_SpringEngine; + __pyx_vtable_14softwrap_core2_SpringEngine.set_bvh = (void (*)(struct __pyx_obj_14softwrap_core2_SpringEngine *, struct __pyx_obj_14softwrap_core2_BVH *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_12SpringEngine_set_bvh; + __pyx_vtable_14softwrap_core2_SpringEngine.create_spring_group = (struct __pyx_obj_14softwrap_core2_SpringLinks *(*)(struct __pyx_obj_14softwrap_core2_SpringEngine *, PyObject *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_12SpringEngine_create_spring_group; + __pyx_vtable_14softwrap_core2_SpringEngine.create_symmetry_map = (struct __pyx_obj_14softwrap_core2_SymmetryMap *(*)(struct __pyx_obj_14softwrap_core2_SpringEngine *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_12SpringEngine_create_symmetry_map; + __pyx_vtable_14softwrap_core2_SpringEngine.create_ternary_links = (struct __pyx_obj_14softwrap_core2_TernarySmoothingLinks *(*)(struct __pyx_obj_14softwrap_core2_SpringEngine *, PyObject *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_12SpringEngine_create_ternary_links; + __pyx_vtable_14softwrap_core2_SpringEngine.create_quaternary_links = (struct __pyx_obj_14softwrap_core2_QuaternarySmoothingLinks *(*)(struct __pyx_obj_14softwrap_core2_SpringEngine *, PyObject *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_12SpringEngine_create_quaternary_links; + __pyx_vtable_14softwrap_core2_SpringEngine.create_mask = (struct __pyx_obj_14softwrap_core2_SpringEngineMask *(*)(struct __pyx_obj_14softwrap_core2_SpringEngine *, PyObject *, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_12SpringEngine_create_mask; + __pyx_vtable_14softwrap_core2_SpringEngine.random_verts = (void (*)(struct __pyx_obj_14softwrap_core2_SpringEngine *, float, int __pyx_skip_dispatch, struct __pyx_opt_args_14softwrap_core2_12SpringEngine_random_verts *__pyx_optional_args))__pyx_f_14softwrap_core2_12SpringEngine_random_verts; + __pyx_vtable_14softwrap_core2_SpringEngine.kinetic_step = (void (*)(struct __pyx_obj_14softwrap_core2_SpringEngine *, float, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_12SpringEngine_kinetic_step; + __pyx_vtable_14softwrap_core2_SpringEngine.update_mesh_normals = (void (*)(struct __pyx_obj_14softwrap_core2_SpringEngine *, float, int __pyx_skip_dispatch))__pyx_f_14softwrap_core2_12SpringEngine_update_mesh_normals; + if (PyType_Ready(&__pyx_type_14softwrap_core2_SpringEngine) < 0) __PYX_ERR(0, 1376, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2_SpringEngine.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2_SpringEngine.tp_dictoffset && __pyx_type_14softwrap_core2_SpringEngine.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2_SpringEngine.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_SetVtable(__pyx_type_14softwrap_core2_SpringEngine.tp_dict, __pyx_vtabptr_14softwrap_core2_SpringEngine) < 0) __PYX_ERR(0, 1376, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SpringEngine, (PyObject *)&__pyx_type_14softwrap_core2_SpringEngine) < 0) __PYX_ERR(0, 1376, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_14softwrap_core2_SpringEngine) < 0) __PYX_ERR(0, 1376, __pyx_L1_error) + __pyx_ptype_14softwrap_core2_SpringEngine = &__pyx_type_14softwrap_core2_SpringEngine; + if (PyType_Ready(&__pyx_type_14softwrap_core2___pyx_scope_struct____iter__) < 0) __PYX_ERR(0, 733, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2___pyx_scope_struct____iter__.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2___pyx_scope_struct____iter__.tp_dictoffset && __pyx_type_14softwrap_core2___pyx_scope_struct____iter__.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2___pyx_scope_struct____iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + __pyx_ptype_14softwrap_core2___pyx_scope_struct____iter__ = &__pyx_type_14softwrap_core2___pyx_scope_struct____iter__; + if (PyType_Ready(&__pyx_type_14softwrap_core2___pyx_scope_struct_1___getitem__) < 0) __PYX_ERR(0, 1157, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2___pyx_scope_struct_1___getitem__.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2___pyx_scope_struct_1___getitem__.tp_dictoffset && __pyx_type_14softwrap_core2___pyx_scope_struct_1___getitem__.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2___pyx_scope_struct_1___getitem__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + __pyx_ptype_14softwrap_core2___pyx_scope_struct_1___getitem__ = &__pyx_type_14softwrap_core2___pyx_scope_struct_1___getitem__; + if (PyType_Ready(&__pyx_type_14softwrap_core2___pyx_scope_struct_2_iter_ring) < 0) __PYX_ERR(0, 1161, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2___pyx_scope_struct_2_iter_ring.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2___pyx_scope_struct_2_iter_ring.tp_dictoffset && __pyx_type_14softwrap_core2___pyx_scope_struct_2_iter_ring.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2___pyx_scope_struct_2_iter_ring.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + __pyx_ptype_14softwrap_core2___pyx_scope_struct_2_iter_ring = &__pyx_type_14softwrap_core2___pyx_scope_struct_2_iter_ring; + if (PyType_Ready(&__pyx_type_14softwrap_core2___pyx_scope_struct_3___iter__) < 0) __PYX_ERR(0, 1168, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2___pyx_scope_struct_3___iter__.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2___pyx_scope_struct_3___iter__.tp_dictoffset && __pyx_type_14softwrap_core2___pyx_scope_struct_3___iter__.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2___pyx_scope_struct_3___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + __pyx_ptype_14softwrap_core2___pyx_scope_struct_3___iter__ = &__pyx_type_14softwrap_core2___pyx_scope_struct_3___iter__; + if (PyType_Ready(&__pyx_type_14softwrap_core2___pyx_scope_struct_4___getitem__) < 0) __PYX_ERR(0, 1348, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2___pyx_scope_struct_4___getitem__.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2___pyx_scope_struct_4___getitem__.tp_dictoffset && __pyx_type_14softwrap_core2___pyx_scope_struct_4___getitem__.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2___pyx_scope_struct_4___getitem__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + __pyx_ptype_14softwrap_core2___pyx_scope_struct_4___getitem__ = &__pyx_type_14softwrap_core2___pyx_scope_struct_4___getitem__; + if (PyType_Ready(&__pyx_type_14softwrap_core2___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 1352, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_14softwrap_core2___pyx_scope_struct_5_genexpr.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_14softwrap_core2___pyx_scope_struct_5_genexpr.tp_dictoffset && __pyx_type_14softwrap_core2___pyx_scope_struct_5_genexpr.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_14softwrap_core2___pyx_scope_struct_5_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + __pyx_ptype_14softwrap_core2___pyx_scope_struct_5_genexpr = &__pyx_type_14softwrap_core2___pyx_scope_struct_5_genexpr; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initsoftwrap_core2(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initsoftwrap_core2(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_softwrap_core2(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_softwrap_core2(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + if (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_softwrap_core2(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'softwrap_core2' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_softwrap_core2(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("softwrap_core2", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_softwrap_core2) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "softwrap_core2")) { + if (unlikely(PyDict_SetItemString(modules, "softwrap_core2", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_type_import_code(); + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "core/core2.pyx":20 + * # along with this program. If not, see . + * + * import atexit # <<<<<<<<<<<<<< + * from libc.math cimport INFINITY + * from libc.limits cimport UINT_MAX + */ + +# line 20 "core/core2.pyx" + __pyx_t_1 = __Pyx_Import(__pyx_n_s_atexit, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + +# line 20 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 20 "core/core2.pyx" + if (PyDict_SetItem(__pyx_d, __pyx_n_s_atexit, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + +# line 20 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "core/core2.pyx":259 + * + * + * cdef dict not_freed_pointers = {} # <<<<<<<<<<<<<< + * + * cdef extern from *: + */ + +# line 259 "core/core2.pyx" + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) + +# line 259 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 259 "core/core2.pyx" + __Pyx_XGOTREF(__pyx_v_14softwrap_core2_not_freed_pointers); + +# line 259 "core/core2.pyx" + __Pyx_DECREF_SET(__pyx_v_14softwrap_core2_not_freed_pointers, ((PyObject*)__pyx_t_1)); + +# line 259 "core/core2.pyx" + __Pyx_GIVEREF(__pyx_t_1); + +# line 259 "core/core2.pyx" + __pyx_t_1 = 0; + + /* "core/core2.pyx":285 + * + * + * def leak_check(): # <<<<<<<<<<<<<< + * import gc + * gc.collect() + */ + +# line 285 "core/core2.pyx" + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_14softwrap_core2_1leak_check, NULL, __pyx_n_s_softwrap_core2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) + +# line 285 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 285 "core/core2.pyx" + if (PyDict_SetItem(__pyx_d, __pyx_n_s_leak_check, __pyx_t_1) < 0) __PYX_ERR(0, 285, __pyx_L1_error) + +# line 285 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "core/core2.pyx":296 + * + * + * atexit.register(leak_check) # <<<<<<<<<<<<<< + * + * + */ + +# line 296 "core/core2.pyx" + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_atexit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error) + +# line 296 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 296 "core/core2.pyx" + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_register); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) + +# line 296 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_2); + +# line 296 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 296 "core/core2.pyx" + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_leak_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error) + +# line 296 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_1); + +# line 296 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) + +# line 296 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 296 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + +# line 296 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + +# line 296 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "core/core2.pyx":1 + * # distutils: language=c++ # <<<<<<<<<<<<<< + * # cython: cdivision=True + * # cython: language_level=3 + */ + +# line 1 "core/core2.pyx" + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) + +# line 1 "core/core2.pyx" + __Pyx_GOTREF(__pyx_t_3); + +# line 1 "core/core2.pyx" + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + +# line 1 "core/core2.pyx" + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "carray.to_py":124 + * + * @cname("__Pyx_carray_to_tuple_float") + * cdef inline tuple __Pyx_carray_to_tuple_float(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef size_t i + * cdef object value + */ + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + if (__pyx_d) { + __Pyx_AddTraceback("init softwrap_core2", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + Py_CLEAR(__pyx_m); + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init softwrap_core2"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} +#endif + +/* WriteUnraisableException */ +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback, CYTHON_UNUSED int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_PyThreadState_declare +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); +#ifdef _MSC_VER + else state = (PyGILState_STATE)-1; +#endif +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif +} + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } +bad: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif +#endif + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallNoArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); + } +#endif +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) +#else + if (likely(PyCFunction_Check(func))) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + +/* PyCFunctionFastCall */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + } +} +#endif + +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (__Pyx_PyFastCFunction_Check(func)) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +/* PyObjectGetMethod */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (descr != NULL) { + *method = descr; + return 0; + } + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'%.50s' object has no attribute '%U'", + tp->tp_name, name); +#else + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(name)); +#endif + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} + +/* PyObjectCallMethod0 */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* UnpackTupleError */ +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +/* UnpackTuple2 */ +static CYTHON_INLINE int __Pyx_unpack_tuple2_exact( + PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) { + PyObject *value1 = NULL, *value2 = NULL; +#if CYTHON_COMPILING_IN_PYPY + value1 = PySequence_ITEM(tuple, 0); if (unlikely(!value1)) goto bad; + value2 = PySequence_ITEM(tuple, 1); if (unlikely(!value2)) goto bad; +#else + value1 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(value1); + value2 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(value2); +#endif + if (decref_tuple) { + Py_DECREF(tuple); + } + *pvalue1 = value1; + *pvalue2 = value2; + return 0; +#if CYTHON_COMPILING_IN_PYPY +bad: + Py_XDECREF(value1); + Py_XDECREF(value2); + if (decref_tuple) { Py_XDECREF(tuple); } + return -1; +#endif +} +static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, + int has_known_size, int decref_tuple) { + Py_ssize_t index; + PyObject *value1 = NULL, *value2 = NULL, *iter = NULL; + iternextfunc iternext; + iter = PyObject_GetIter(tuple); + if (unlikely(!iter)) goto bad; + if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; } + iternext = Py_TYPE(iter)->tp_iternext; + value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; } + value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; } + if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad; + Py_DECREF(iter); + *pvalue1 = value1; + *pvalue2 = value2; + return 0; +unpacking_failed: + if (!has_known_size && __Pyx_IterFinish() == 0) + __Pyx_RaiseNeedMoreValuesError(index); +bad: + Py_XDECREF(iter); + Py_XDECREF(value1); + Py_XDECREF(value2); + if (decref_tuple) { Py_XDECREF(tuple); } + return -1; +} + +/* dict_iter */ +static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name, + Py_ssize_t* p_orig_length, int* p_source_is_dict) { + is_dict = is_dict || likely(PyDict_CheckExact(iterable)); + *p_source_is_dict = is_dict; + if (is_dict) { +#if !CYTHON_COMPILING_IN_PYPY + *p_orig_length = PyDict_Size(iterable); + Py_INCREF(iterable); + return iterable; +#elif PY_MAJOR_VERSION >= 3 + static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL; + PyObject **pp = NULL; + if (method_name) { + const char *name = PyUnicode_AsUTF8(method_name); + if (strcmp(name, "iteritems") == 0) pp = &py_items; + else if (strcmp(name, "iterkeys") == 0) pp = &py_keys; + else if (strcmp(name, "itervalues") == 0) pp = &py_values; + if (pp) { + if (!*pp) { + *pp = PyUnicode_FromString(name + 4); + if (!*pp) + return NULL; + } + method_name = *pp; + } + } +#endif + } + *p_orig_length = 0; + if (method_name) { + PyObject* iter; + iterable = __Pyx_PyObject_CallMethod0(iterable, method_name); + if (!iterable) + return NULL; +#if !CYTHON_COMPILING_IN_PYPY + if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable)) + return iterable; +#endif + iter = PyObject_GetIter(iterable); + Py_DECREF(iterable); + return iter; + } + return PyObject_GetIter(iterable); +} +static CYTHON_INLINE int __Pyx_dict_iter_next( + PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos, + PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) { + PyObject* next_item; +#if !CYTHON_COMPILING_IN_PYPY + if (source_is_dict) { + PyObject *key, *value; + if (unlikely(orig_length != PyDict_Size(iter_obj))) { + PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); + return -1; + } + if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) { + return 0; + } + if (pitem) { + PyObject* tuple = PyTuple_New(2); + if (unlikely(!tuple)) { + return -1; + } + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(tuple, 0, key); + PyTuple_SET_ITEM(tuple, 1, value); + *pitem = tuple; + } else { + if (pkey) { + Py_INCREF(key); + *pkey = key; + } + if (pvalue) { + Py_INCREF(value); + *pvalue = value; + } + } + return 1; + } else if (PyTuple_CheckExact(iter_obj)) { + Py_ssize_t pos = *ppos; + if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0; + *ppos = pos + 1; + next_item = PyTuple_GET_ITEM(iter_obj, pos); + Py_INCREF(next_item); + } else if (PyList_CheckExact(iter_obj)) { + Py_ssize_t pos = *ppos; + if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0; + *ppos = pos + 1; + next_item = PyList_GET_ITEM(iter_obj, pos); + Py_INCREF(next_item); + } else +#endif + { + next_item = PyIter_Next(iter_obj); + if (unlikely(!next_item)) { + return __Pyx_IterFinish(); + } + } + if (pitem) { + *pitem = next_item; + } else if (pkey && pvalue) { + if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1)) + return -1; + } else if (pkey) { + *pkey = next_item; + } else { + *pvalue = next_item; + } + return 1; +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + CYTHON_UNUSED Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind; + Py_ssize_t i, char_pos; + void *result_udata; +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) + goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely(char_pos + ulength < 0)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind)); + } else { + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif + } + char_pos += ulength; + } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + result_ulength++; + value_count++; + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); +#endif +} + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return m->sq_ass_item(o, i, v); + } + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) +#else + if (is_list || PySequence_Check(o)) +#endif + { + return PySequence_SetItem(o, i, v); + } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + __Pyx_PyThreadState_declare + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +/* RaiseArgTupleInvalid */ +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 *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"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* RaiseDoubleKeywords */ +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_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +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; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; +} + +/* PyObjectCallMethod1 */ +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +} + +/* append */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; + } else { + PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); + if (unlikely(!retval)) + return -1; + Py_DECREF(retval); + } + return 0; +} + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +/* pyfrozenset_new */ +static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) { + if (it) { + PyObject* result; +#if CYTHON_COMPILING_IN_PYPY + PyObject* args; + args = PyTuple_Pack(1, it); + if (unlikely(!args)) + return NULL; + result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL); + Py_DECREF(args); + return result; +#else + if (PyFrozenSet_CheckExact(it)) { + Py_INCREF(it); + return it; + } + result = PyFrozenSet_New(it); + if (unlikely(!result)) + return NULL; + if ((PY_VERSION_HEX >= 0x031000A1) || likely(PySet_GET_SIZE(result))) + return result; + Py_DECREF(result); +#endif + } +#if CYTHON_USE_TYPE_SLOTS + return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL); +#else + return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL); +#endif +} + +/* PySetContains */ +static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) { + int result = -1; + if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) { + PyObject *tmpkey; + PyErr_Clear(); + tmpkey = __Pyx_PyFrozenSet_New(key); + if (tmpkey != NULL) { + result = PySet_Contains(set, tmpkey); + Py_DECREF(tmpkey); + } + } + return result; +} +static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) { + int result = PySet_Contains(set, key); + if (unlikely(result < 0)) { + result = __Pyx_PySet_ContainsUnhashable(set, key); + } + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* None */ +static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { + PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); +} + +/* FetchCommonType */ +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* fake_module; + PyTypeObject* cached_type = NULL; + fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); + if (!fake_module) return NULL; + Py_INCREF(fake_module); + cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + if (cached_type) { + if (!PyType_Check((PyObject*)cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", + type->tp_name); + goto bad; + } + if (cached_type->tp_basicsize != type->tp_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + type->tp_name); + goto bad; + } + } else { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; + } +done: + Py_DECREF(fake_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CythonFunctionShared */ +#include +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +{ + if (unlikely(op->func_doc == NULL)) { + if (op->func.m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp = op->func_doc; + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + op->func_doc = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + if (unlikely(op->func_name == NULL)) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = op->func_qualname; + Py_INCREF(value); + op->func_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyTuple_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_tuple; + op->defaults_tuple = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_kwdict; + op->defaults_kwdict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { + PyObject* tmp; + if (!value || value == Py_None) { + value = NULL; + } else if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + tmp = op->func_annotations; + op->func_annotations = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + Py_INCREF(m->func_qualname); + return m->func_qualname; +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + if (unlikely(op == NULL)) + return NULL; + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; + op->func.m_ml = ml; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; + op->func_classobj = NULL; + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + PyObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ +#if PY_MAJOR_VERSION < 3 + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; +#endif + return __Pyx_PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + Py_ssize_t size; + switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 0)) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; + } + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; + argc = PyTuple_GET_SIZE(args); + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, + 0, + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_CyFunction_descr_get, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, +#endif +}; +static int __pyx_CyFunction_init(void) { + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* DictGetItem */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return NULL; + } + Py_INCREF(value); + return value; +} +#endif + +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + #endif + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; icurexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; + if (unlikely(PyTuple_Check(err))) + return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); +} +#endif + +/* PyObject_GenericGetAttrNoDict */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'%.50s' object has no attribute '%U'", + tp->tp_name, attr_name); +#else + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(attr_name)); +#endif + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); + } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); + } + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) + #endif + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; + } + } + return descr; +} +#endif + +/* SetVTable */ +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + +/* SetupReduce */ +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; +#else + if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; +#endif +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } + } + PyType_Modified((PyTypeObject*)type_obj); + } + } + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) + PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* PyObject_GenericGetAttr */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); + } + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* CLineInTraceback */ +#ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; +#endif + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; + py_srcfile = PyString_FromString(filename); + if (!py_srcfile) goto bad; + #endif + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + if (!py_funcname) goto bad; + #endif + } + #if PY_MAJOR_VERSION < 3 + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline + return py_code; +bad: + Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) + case -2: + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(unsigned int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (unsigned int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (unsigned int) 0; + case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0]) + case 2: + if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) { + return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) { + return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) { + return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (unsigned int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(unsigned int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (unsigned int) 0; + case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0]) + case -2: + if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { + return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { + return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { + return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { + return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) { + return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) { + return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + } +#endif + if (sizeof(unsigned int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + unsigned int val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (unsigned int) -1; + } + } else { + unsigned int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (unsigned int) -1; + val = __Pyx_PyInt_As_unsigned_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned int"); + return (unsigned int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned int"); + return (unsigned int) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(unsigned int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(unsigned int), + little, !is_unsigned); + } +} + +/* CIntFromPy */ +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(size_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (size_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (size_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(size_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (size_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) + case -2: + if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(size_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + size_t val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (size_t) -1; + } + } else { + size_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyInt_As_size_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (long) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (long) 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (long) 0; + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) + case -2: + if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } +#endif + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + long val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (long) -1; + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = a->tp_base; + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; + if (!res) { + res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } + return res; +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; iexc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* CoroutineBase */ +#include +#include +#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) +static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; + } +#if PY_VERSION_HEX >= 0x030300A0 + else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) { + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); + } +#endif + else if (unlikely(PyTuple_Check(ev))) { + if (PyTuple_GET_SIZE(ev) >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#else + value = PySequence_ITEM(ev, 0); +#endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if PY_VERSION_HEX >= 0x030300A0 + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); +#else + { + PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); + Py_DECREF(ev); + if (likely(args)) { + value = PySequence_GetItem(args, 0); + Py_DECREF(args); + } + if (unlikely(!value)) { + __Pyx_ErrRestore(NULL, NULL, NULL); + Py_INCREF(Py_None); + value = Py_None; + } + } +#endif + *pvalue = value; + return 0; +} +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); +} +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) { + const char *msg; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +#define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) { + const char *msg; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(gen)) { + msg = "can't send non-None value to a just-started coroutine"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(gen)) { + msg = "can't send non-None value to a just-started async generator"; + #endif + } else { + msg = "can't send non-None value to a just-started generator"; + } + PyErr_SetString(PyExc_TypeError, msg); +} +#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) { + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } +} +static +PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(!self->is_running); + if (unlikely(self->resume_label == 0)) { + if (unlikely(value && value != Py_None)) { + return __Pyx_Coroutine_NotStartedError((PyObject*)self); + } + } + if (unlikely(self->resume_label == -1)) { + return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; +#endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_type) { + #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON + #else + if (exc_state->exc_traceback) { + PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + } + #endif + } +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; +#else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } +#endif + self->is_running = 1; + retval = self->body((PyObject *) self, tstate, value); + self->is_running = 0; +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); +#endif + return retval; +} +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { + PyObject *exc_tb = exc_state->exc_traceback; + if (likely(exc_tb)) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON +#else + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); +#endif + } +} +static CYTHON_INLINE +PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) { + if (unlikely(!retval)) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (!__Pyx_PyErr_Occurred()) { + PyObject *exc = PyExc_StopIteration; + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + exc = __Pyx_PyExc_StopAsyncIteration; + #endif + __Pyx_PyErr_SetNone(exc); + } + } + return retval; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) +static CYTHON_INLINE +PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { +#if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); +#else + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); + } + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); + } + else { + _PyGen_SetStopIterationValue(result); + } + Py_CLEAR(result); + } + return result; +#endif +} +#endif +static CYTHON_INLINE +PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { + PyObject *ret; + PyObject *val = NULL; + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + ret = __Pyx_Coroutine_SendEx(gen, val, 0); + Py_XDECREF(val); + return ret; +} +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + gen->is_running = 1; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + { + if (value == Py_None) + ret = Py_TYPE(yf)->tp_iternext(yf); + else + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); + } + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + retval = __Pyx_Coroutine_FinishDelegation(gen); + } else { + retval = __Pyx_Coroutine_SendEx(gen, value, 0); + } + return __Pyx_Coroutine_MethodReturn(self, retval); +} +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + PyObject *retval = NULL; + int err = 0; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + retval = __Pyx_Coroutine_Close(yf); + if (!retval) + return -1; + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + retval = __Pyx_Coroutine_Close(yf); + if (!retval) + return -1; + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL); + if (!retval) + return -1; + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + } else + #endif + { + PyObject *meth; + gen->is_running = 1; + meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close); + if (unlikely(!meth)) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_WriteUnraisable(yf); + } + PyErr_Clear(); + } else { + retval = PyObject_CallFunction(meth, NULL); + Py_DECREF(meth); + if (!retval) + err = -1; + } + gen->is_running = 0; + } + Py_XDECREF(retval); + return err; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + gen->is_running = 1; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + ret = Py_TYPE(yf)->tp_iternext(yf); + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Coroutine_FinishDelegation(gen); + } + return __Pyx_Coroutine_SendEx(gen, Py_None, 0); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __Pyx_Coroutine_Close(self); +} +static PyObject *__Pyx_Coroutine_Close(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *retval, *raised_exception; + PyObject *yf = gen->yieldfrom; + int err = 0; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + retval = __Pyx_Coroutine_SendEx(gen, NULL, 1); + if (unlikely(retval)) { + const char *msg; + Py_DECREF(retval); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { +#if PY_VERSION_HEX < 0x03060000 + msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)"; +#else + msg = "async generator ignored GeneratorExit"; +#endif + #endif + } else { + msg = "generator ignored GeneratorExit"; + } + PyErr_SetString(PyExc_RuntimeError, msg); + return NULL; + } + raised_exception = PyErr_Occurred(); + if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) { + if (raised_exception) PyErr_Clear(); + Py_INCREF(Py_None); + return Py_None; + } + return NULL; +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(gen->is_running)) + return __Pyx_Coroutine_AlreadyRunningError(gen); + if (yf) { + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); + goto throw_here; + } + gen->is_running = 1; + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + gen->is_running = 0; + return NULL; + } + PyErr_Clear(); + __Pyx_Coroutine_Undelegate(gen); + gen->is_running = 0; + goto throw_here; + } + if (likely(args)) { + ret = PyObject_CallObject(meth, args); + } else { + ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL); + } + Py_DECREF(meth); + } + gen->is_running = 0; + Py_DECREF(yf); + if (!ret) { + ret = __Pyx_Coroutine_FinishDelegation(gen); + } + return __Pyx_Coroutine_MethodReturn(self, ret); + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); + return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); +} +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); +} +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + Py_CLEAR(gen->yieldfrom); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; +} +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + if (gen->gi_weakreflist != NULL) + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE + if (PyObject_CallFinalizerFromDealloc(self)) +#else + Py_TYPE(gen)->tp_del(self); + if (Py_REFCNT(self) > 0) +#endif + { + return; + } + PyObject_GC_UnTrack(self); + } +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } +#endif + __Pyx_Coroutine_clear(self); + PyObject_GC_Del(gen); +} +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } +#if !CYTHON_USE_TP_FINALIZE + assert(self->ob_refcnt == 0); + __Pyx_SET_REFCNT(self, 1); +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } + } +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); +#if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat) + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); +#else + {PyObject *msg; + char *cmsg; + #if CYTHON_COMPILING_IN_PYPY + msg = NULL; + cmsg = (char*) "coroutine was never awaited"; + #else + char *cname; + PyObject *qualname; + qualname = gen->gi_qualname; + cname = PyString_AS_STRING(qualname); + msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname); + if (unlikely(!msg)) { + PyErr_Clear(); + cmsg = (char*) "coroutine was never awaited"; + } else { + cmsg = PyString_AS_STRING(msg); + } + #endif + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0)) + PyErr_WriteUnraisable(self); + Py_XDECREF(msg);} +#endif + PyObject_GC_Track(self); + } +#endif + } else { + PyObject *res = __Pyx_Coroutine_Close(self); + if (unlikely(!res)) { + if (PyErr_Occurred()) + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); +#if !CYTHON_USE_TP_FINALIZE + assert(Py_REFCNT(self) > 0); + if (--self->ob_refcnt == 0) { + return; + } + { + Py_ssize_t refcnt = Py_REFCNT(self); + _Py_NewReference(self); + __Pyx_SET_REFCNT(self, refcnt); + } +#if CYTHON_COMPILING_IN_CPYTHON + assert(PyType_IS_GC(Py_TYPE(self)) && + _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); + _Py_DEC_REFTOTAL; +#endif +#ifdef COUNT_ALLOCS + --Py_TYPE(self)->tp_frees; + --Py_TYPE(self)->tp_allocs; +#endif +#endif +} +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) +{ + PyObject *name = self->gi_name; + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = self->gi_name; + Py_INCREF(value); + self->gi_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) +{ + PyObject *name = self->gi_qualname; + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = self->gi_qualname; + Py_INCREF(value); + self->gi_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) +{ + PyObject *frame = self->gi_frame; + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; + } + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (unlikely(!frame)) + return NULL; + self->gi_frame = frame; + } + Py_INCREF(frame); + return frame; +} +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif + gen->gi_weakreflist = NULL; + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; +} + +/* PatchModuleWithCoroutine */ +static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + int result; + PyObject *globals, *result_obj; + globals = PyDict_New(); if (unlikely(!globals)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_coroutine_type", + #ifdef __Pyx_Coroutine_USED + (PyObject*)__pyx_CoroutineType); + #else + Py_None); + #endif + if (unlikely(result < 0)) goto ignore; + result = PyDict_SetItemString(globals, "_cython_generator_type", + #ifdef __Pyx_Generator_USED + (PyObject*)__pyx_GeneratorType); + #else + Py_None); + #endif + if (unlikely(result < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; + if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; + result_obj = PyRun_String(py_code, Py_file_input, globals, globals); + if (unlikely(!result_obj)) goto ignore; + Py_DECREF(result_obj); + Py_DECREF(globals); + return module; +ignore: + Py_XDECREF(globals); + PyErr_WriteUnraisable(module); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { + Py_DECREF(module); + module = NULL; + } +#else + py_code++; +#endif + return module; +} + +/* PatchGeneratorABC */ +#ifndef CYTHON_REGISTER_ABCS +#define CYTHON_REGISTER_ABCS 1 +#endif +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) +static PyObject* __Pyx_patch_abc_module(PyObject *module); +static PyObject* __Pyx_patch_abc_module(PyObject *module) { + module = __Pyx_Coroutine_patch_module( + module, "" +"if _cython_generator_type is not None:\n" +" try: Generator = _module.Generator\n" +" except AttributeError: pass\n" +" else: Generator.register(_cython_generator_type)\n" +"if _cython_coroutine_type is not None:\n" +" try: Coroutine = _module.Coroutine\n" +" except AttributeError: pass\n" +" else: Coroutine.register(_cython_coroutine_type)\n" + ); + return module; +} +#endif +static int __Pyx_patch_abc(void) { +#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + static int abc_patched = 0; + if (CYTHON_REGISTER_ABCS && !abc_patched) { + PyObject *module; + module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections"); + if (!module) { + PyErr_WriteUnraisable(NULL); + if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, + ((PY_MAJOR_VERSION >= 3) ? + "Cython module failed to register with collections.abc module" : + "Cython module failed to register with collections module"), 1) < 0)) { + return -1; + } + } else { + module = __Pyx_patch_abc_module(module); + abc_patched = 1; + if (unlikely(!module)) + return -1; + Py_DECREF(module); + } + module = PyImport_ImportModule("backports_abc"); + if (module) { + module = __Pyx_patch_abc_module(module); + Py_XDECREF(module); + } + if (!module) { + PyErr_Clear(); + } + } +#else + if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL); +#endif + return 0; +} + +/* Generator */ +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Generator_memberlist[] = { + {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, + {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, + {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Generator_getsets[] = { + {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + (char*) PyDoc_STR("name of the generator"), 0}, + {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + (char*) PyDoc_STR("qualified name of the generator"), 0}, + {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + (char*) PyDoc_STR("Frame of the generator"), 0}, + {0, 0, 0, 0, 0} +}; +static PyTypeObject __pyx_GeneratorType_type = { + PyVarObject_HEAD_INIT(0, 0) + "generator", + sizeof(__pyx_CoroutineObject), + 0, + (destructor) __Pyx_Coroutine_dealloc, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, + 0, + (traverseproc) __Pyx_Coroutine_traverse, + 0, + 0, + offsetof(__pyx_CoroutineObject, gi_weakreflist), + 0, + (iternextfunc) __Pyx_Generator_Next, + __pyx_Generator_methods, + __pyx_Generator_memberlist, + __pyx_Generator_getsets, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if CYTHON_USE_TP_FINALIZE + 0, +#else + __Pyx_Coroutine_del, +#endif + 0, +#if CYTHON_USE_TP_FINALIZE + __Pyx_Coroutine_del, +#elif PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + 0, +#endif +}; +static int __pyx_Generator_init(void) { + __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; + __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); + if (unlikely(!__pyx_GeneratorType)) { + return -1; + } + return 0; +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + return PyErr_WarnEx(NULL, message, 1); + } + return 0; +} + +/* InitStrings */ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + if (PyObject_Hash(*t->p) == -1) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#if !CYTHON_PEP393_ENABLED +static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +} +#else +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +} +#endif +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif +#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { +#if PY_MAJOR_VERSION >= 3 + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type %.200s). " + "The ability to return an instance of a strict subclass of int " + "is deprecated, and may be removed in a future version of Python.", + Py_TYPE(result)->tp_name)) { + Py_DECREF(result); + return NULL; + } + return result; + } +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type %.200s)", + type_name, type_name, Py_TYPE(result)->tp_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x) || PyLong_Check(x))) +#else + if (likely(PyLong_Check(x))) +#endif + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + #if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = m->nb_int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = m->nb_long(x); + } + #else + if (likely(m && m->nb_int)) { + name = "int"; + res = m->nb_int(x); + } + #endif +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Int(x); + } +#endif + if (likely(res)) { +#if PY_MAJOR_VERSION < 3 + if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { +#else + if (unlikely(!PyLong_CheckExact(res))) { +#endif + return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) { + if (sizeof(Py_ssize_t) >= sizeof(long)) + return PyInt_AS_LONG(b); + else + return PyInt_AsSsize_t(b); + } +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)b)->ob_digit; + const Py_ssize_t size = Py_SIZE(b); + if (likely(__Pyx_sst_abs(size) <= 1)) { + ival = likely(size) ? digits[0] : 0; + if (size == -1) ival = -ival; + return ival; + } else { + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { + return PyInt_FromSize_t(ival); +} + + +#endif /* Py_PYTHON_H */ + diff --git a/softwrap2/core/core2.pyx b/softwrap2/core/core2.pyx new file mode 100644 index 0000000..1242d98 --- /dev/null +++ b/softwrap2/core/core2.pyx @@ -0,0 +1,1559 @@ +# distutils: language=c++ +# cython: cdivision=True +# cython: language_level=3 +# cython: boundscheck=False +# cython: nonecheck=False + +# Copyright (C) 2021 Jean Da Costa machado. +# Jean3dimensional@gmail.com +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import atexit +from libc.math cimport INFINITY +from libc.limits cimport UINT_MAX +from libc.stdlib cimport calloc, malloc, free +from libc.stdint cimport uintptr_t +from libc.string cimport memset +from cython.parallel cimport prange, parallel +cimport cython + + +cdef extern from *: + ''' + template + CYTHON_INLINE T1 nmax(T1 a, T2 b) {return a > b ? a : (T1)b;} + + template + CYTHON_INLINE T1 nmin(T1 a, T2 b) {return a < b ? a : (T1)b;} + + template + CYTHON_INLINE T1 nabs(T1 a) {return a < 0 ? -a : a;} + + template + CYTHON_INLINE T1 nlerp(T1 a, T2 b, T3 t) {return a + (b - a) * t;} + + template + CYTHON_INLINE T1 nclamp(T1 a, T2 min, T3 max) {return nmax(nmin(a, max), min);} + + + ''' + + T1 nmin[T1, T2](T1, T2) nogil + T1 nmax[T1, T2](T1, T2) nogil + T1 nabs[T1](T1) nogil + T1 nlerp[T1, T2, T3](T1, T2, T3) nogil + T1 nclamp[T1, T2, T3](T1, T2, T3) nogil + + +cdef extern from *: + ''' + #define EPS 0.00001f + struct vec3 { + float v[3]; + + vec3 (float a[3]) { + v[0] = a[0]; + v[1] = a[1]; + v[2] = a[2]; + } + + vec3 (float x, float y, float z) { + v[0] = x; + v[1] = y; + v[2] = z; + } + + vec3 (float f) { + v[0] = f; + v[1] = f; + v[2] = f; + } + + vec3() = default; + + #define VEC_OP(op)\\ + CYTHON_INLINE vec3 operator op (vec3 other) {\\ + return vec3(v[0] op other.v[0], v[1] op other.v[1], v[2] op other.v[2]);\\ + } + + VEC_OP(+) + VEC_OP(-) + VEC_OP(*) + VEC_OP(/) + VEC_OP(+=) + VEC_OP(-=) + VEC_OP(*=) + VEC_OP(/=) + + #undef VEC_OP + #define VEC_OP(op)\\ + CYTHON_INLINE vec3 operator op (float other) {\\ + return vec3(v[0] op other, v[1] op other, v[2] op other);\\ + } + + VEC_OP(+) + VEC_OP(-) + VEC_OP(*) + VEC_OP(/) + VEC_OP(+=) + VEC_OP(-=) + VEC_OP(*=) + VEC_OP(/=) + VEC_OP(=) + + #undef VEC_OP + CYTHON_INLINE float& x() { return v[0];} + CYTHON_INLINE float& y() { return v[1];} + CYTHON_INLINE float& z() { return v[2];} + CYTHON_INLINE float sum() {return v[0] + v[1] + v[2];} + CYTHON_INLINE float dot(vec3 other) {return v[0] * other.v[0] + v[1] * other.v[1] + v[2] * other.v[2];} + CYTHON_INLINE float len() {return sqrtf(this->dot(*this));} + CYTHON_INLINE float len_sqr() {return this->dot(*this);} + CYTHON_INLINE void normalize() { + float f = this->len(); + if (f == 0) { + return; + } + f = 1 / f; + *this *= f; + } + CYTHON_INLINE vec3 normalized() { + float f = this->len(); + if (f == 0) { + return *this; + } + f = 1 / f; + return *this * f; + } + CYTHON_INLINE vec3 project(vec3 other) {return other * (this->dot(other) / other.dot(other));} + CYTHON_INLINE vec3 project_unit(vec3 other) {return other * this->dot(other);} + CYTHON_INLINE vec3 cross(vec3 other) { + return vec3(v[1] * other.v[2] - v[2] * other.v[1], + v[2] * other.v[0] - v[0] * other.v[2], + v[0] * other.v[1] - v[1] * other.v[0]); + } + + CYTHON_INLINE vec3 max_aa(vec3 other) { + return vec3(nmax(v[0], other.v[0]), nmax(v[1], other.v[1]), nmax(v[2], other.v[2])); + } + CYTHON_INLINE vec3 min_aa(vec3 other) { + return vec3(nmin(v[0], other.v[0]), nmin(v[1], other.v[1]), nmin(v[2], other.v[2])); + } + CYTHON_INLINE vec3 lerp(vec3 other, float fac) { + return *this + (other - *this) * fac; + } + CYTHON_INLINE vec3 clamp(float min, float max) { + float d = this->dot(*this); + if (d == 0) { + return *this; + } + else if (d < min * min) { + return *this * (1 / sqrtf(d) * min); + } + else if (d > max * max) { + return *this * (1 / sqrtf(d) * max); + } + return *this; + } + }; + ''' + float EPS + float sqrtf(float) nogil + cdef cppclass vec3 nogil: + float v[3] + vec3(float a[3]) nogil + vec3(float, float, float) nogil + vec3(float) nogil + vec3() nogil + vec3 operator + (vec3) nogil + vec3 operator - (vec3) nogil + vec3 operator * (vec3) nogil + vec3 operator / (vec3) nogil + vec3 operator + (float) nogil + vec3 operator - (float) nogil + vec3 operator * (float) nogil + vec3 operator / (float) nogil + vec3 operator = (float) nogil + float & x() nogil + float & y() nogil + float & z() nogil + float sum() nogil + float dot(vec3) nogil + float len() nogil + float len_sqr() nogil + void normalize() nogil + vec3 normalized() nogil + vec3 project(vec3) nogil + vec3 project_unit(vec3) nogil + vec3 cross(vec3) nogil + vec3 max_aa(vec3) nogil + vec3 min_aa(vec3) nogil + vec3 lerp(vec3, float) nogil + vec3 clamp(float, float) nogil + +cdef extern from *: + ''' + CYTHON_INLINE vec3 project_point_triangle(vec3& a, vec3& b, vec3& c, vec3& n, vec3& p){ + vec3 edge_v = b - a; + vec3 pv = p - a; + vec3 n1 = edge_v.cross(pv); + + if (n1.dot(n) < 0){ + return edge_v * nclamp(edge_v.dot(pv) / (edge_v.dot(edge_v) + EPS), 0, 1) + a; + } + + edge_v = c - b; + pv = p - b; + n1 = edge_v.cross(pv); + + if (n1.dot(n) < 0){ + return edge_v * nclamp(edge_v.dot(pv) / (edge_v.dot(edge_v) + EPS), 0, 1) + b; + } + + edge_v = a - c; + pv = p - c; + n1 = edge_v.cross(pv); + + if (n1.dot(n) < 0){ + return edge_v * nclamp(edge_v.dot(pv) / (edge_v.dot(edge_v) + EPS), 0, 1) + c; + } + + return p - pv.project_unit(n); + } + + CYTHON_INLINE vec3 project_point_plane(vec3& p, vec3& pp, vec3& pn){ + vec3 v = (p - pp).project_unit(pn); + return p - v; + } + ''' + vec3 project_point_triangle(vec3 & a, vec3 & b, vec3 & c, vec3 & n, vec3 & p) nogil + vec3 project_point_plane(vec3& p, vec3& pp, vec3& pn) nogil + +# ctypedef fused number: +# char +# signed char +# unsigned char +# int +# signed int +# unsigned int +# short int +# signed short int +# unsigned short int +# long int +# signed long int +# unsigned long int +# float +# double +# long double + + +cdef dict not_freed_pointers = {} + +cdef extern from *: + "" + int __LINE__ + +cdef void* maelloc(size_t size, int id) except NULL: + cdef void* ptr = malloc(size) + if ptr == NULL: + raise MemoryError + not_freed_pointers[ptr] = id + return ptr + +cdef void* caelloc(size_t n, size_t size, int id) except NULL: + cdef void* ptr = calloc(n, size) + if ptr == NULL: + raise MemoryError + not_freed_pointers[ptr] = id + return ptr + +cdef void fraeee(void* ptr): + if ptr is not NULL: + del not_freed_pointers[ ptr] + free(ptr) + + +def leak_check(): + import gc + gc.collect() + + if not_freed_pointers: + print('\n ------------ Oops Softwrap2 memory leak detected ------------ \n pointers not freed:') + for ptr, line in not_freed_pointers.items(): + print(f' ptr: {hex(ptr)}, core2.pyx:{line}') + print('\n -------------------------------------------------------------') + + +atexit.register(leak_check) + + +cdef list vec3arr_to_list(vec3* arr, int size): + cdef list l = [None] * size + cdef int i + for i in range(size): + l[i] = (arr[i].v[0], arr[i].v[1], arr[i].v[2]) + + return l + + +cdef inline unsigned int xorshift(unsigned int* seed) nogil: + seed[0] ^= seed[0] << 11 + seed[0] ^= seed[0] >> 17 + seed[0] ^= seed[0] << 9 + return seed[0] + +cdef inline float uint2neg1pos1f(unsigned int v) nogil: + return v / ( 0xffffffff >> 1) - 1.0 + +cdef float xorshiftf(unsigned int* seed) nogil: + return uint2neg1pos1f(xorshift(seed)) + + +cpdef index_check(int idx, int size): + if idx < 0 or idx >= size: + raise IndexError(idx) + +@cython.final +cdef class Mesh: + cdef: + vec3* verts + int[3]* triangles + vec3* centroids + vec3* vert_normals + vec3* face_normals + int n_verts + int n_triangles + + def get_vert_normals(self): + return vec3arr_to_list(self.vert_normals, self.n_verts) + + def get_face_normals(self): + return vec3arr_to_list(self.face_normals, self.n_triangles) + + def __init__(self, verts, triangles): + self.n_verts = len(verts) + self.n_triangles = len(triangles) + + if len(verts) < 3 or len(triangles) < 1: + raise ValueError('Invalid or empty mesh') + + self.verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + self.triangles = maelloc(sizeof(int[3]) * self.n_triangles, __LINE__) + + cdef int i + for i in range(self.n_verts): + self.verts[i].v = verts[i] + + for i in range(self.n_triangles): + self.triangles[i] = triangles[i] + + cdef inline vec3*tri_vert_ptr(self, int tri, int tri_i) nogil: + return & self.verts[self.triangles[tri][tri_i]] + + cdef inline vec3 tri_vert(self, int tri, int tri_i) nogil: + return self.verts[self.triangles[tri][tri_i]] + + cpdef void update_face_normals(self): + if not self.face_normals: + self.face_normals = caelloc(self.n_triangles, sizeof(vec3), __LINE__) + + cdef int i + + cdef vec3* a + cdef vec3* b + cdef vec3* c + with nogil: + for i in prange(self.n_triangles): + a = self.tri_vert_ptr(i, 0) + b = self.tri_vert_ptr(i, 1) + c = self.tri_vert_ptr(i, 2) + self.face_normals[i] = (b[0] - a[0]).cross(c[0] - a[0]).normalized() + + cpdef void update_vert_normals(self): + if not self.vert_normals: + self.vert_normals = caelloc(self.n_verts, sizeof(vec3), __LINE__) + + cdef int i, j + + cdef int * tri + + with nogil: + for i in prange(self.n_verts): + self.vert_normals[i] = vec3(0) + + for i in range(self.n_triangles): + tri = self.triangles[i] + for j in range(3): + self.vert_normals[tri[j]] += self.face_normals[i] + + for i in prange(self.n_verts): + self.vert_normals[i].normalize() + + cpdef void update_centroids(self): + if not self.centroids: + self.centroids = maelloc(sizeof(vec3) * self.n_triangles, __LINE__) + + cdef int i + for i in prange(self.n_triangles, nogil=True): + self.centroids[i] = (self.tri_vert(i, 0) + self.tri_vert(i, 1) + self.tri_vert(i, 2)) / 3 + + + def closest_vert(self, pos): + cdef vec3 p + cdef float tmp_dist, dist = INFINITY + cdef int i=0, idx = -1 + + p.v = pos + + for i in range(self.n_verts): + tmp_dist = (self.verts[i] - p).len_sqr() + if tmp_dist < dist: + dist = tmp_dist + idx = i + + return idx, self.verts[idx].v + + + def __dealloc__(self): + fraeee(self.verts) + fraeee(self.triangles) + fraeee(self.centroids) + fraeee(self.face_normals) + fraeee(self.vert_normals) + + +cdef extern from *: + ''' + #include + + union BvhNode; + struct BvhNodeBox; + struct BvhNodeLeaf; + + struct BvhNodeBox { + int split_axis; + float split_pos; + vec3 min, max; + BvhNode* nodes[2]; + + // BvhNodeBox() { + // split_axis = -1; + // min = vec3(INFINITY); + // max = vec3(-INFINITY); + // } + // CYTHON_INLINE void expand(BvhNodeBox other) { + // min = min.min_aa(other.min); + // max = max.max_aa(other.max); + // } + CYTHON_INLINE void expand(vec3 other) { + min = min.min_aa(other); + max = max.max_aa(other); + } + CYTHON_INLINE int major_axis(){ + int axis = 0; + float curr_le, le = 0; + + for (int i=0; i<3; i++){ + curr_le = max.v[i] - min.v[i]; + if (curr_le > le){ + axis = i; + le = curr_le; + } + } + return axis; + } + CYTHON_INLINE vec3 box_center(){ + return (max + min) * 0.5; + } + CYTHON_INLINE float box_center_axis(int axis){ + return (max.v[axis] + min.v[axis]) * 0.5f; + } + CYTHON_INLINE float box_distance_sqr(vec3 p){ + return (p - max.min_aa(min.max_aa(p))).len_sqr(); + } + CYTHON_INLINE void set_split_axis(int axis){ + this->split_axis = ~axis; + } + CYTHON_INLINE int get_split_axis(){ + return ~this->split_axis; + } + CYTHON_INLINE int is_leaf() { + return split_axis >= 0; + } + }; + + struct BvhNodeLeaf { + int index; + // BvhNodeLeaf (int _index) { + // index = _index; + // } + }; + + union BvhNode{ + BvhNodeBox box; + BvhNodeLeaf leaf; + CYTHON_INLINE int is_leaf() { + return leaf.index >= 0; + } + }; + + struct BvhNearestResult { + vec3 point; + float distance; + int tri_index; + }; + ''' + + cdef cppclass BvhNodeBox: + int split_axis + float split_pos + vec3 min, max + BvhNode * nodes[2] + # BvhNodeBox() nogil + void expand(BvhNodeBox) nogil + void expand(vec3) nogil + int major_axis() nogil + vec3 box_center() nogil + float box_center_axis(int) nogil + int box_distance_sqr(vec3) nogil + void set_split_axis(int) nogil + int get_split_axis() nogil + bint is_leaf() nogil + + cdef cppclass BvhNodeLeaf: + int type, index + # BvhNodeLeaf(int) nogil + + union BvhNode: + BvhNodeBox box + BvhNodeLeaf leaf + bint is_leaf() nogil + + struct BvhNearestResult: + vec3 point + float distance + int tri_index + + +# cdef struct BvhNearestResult: +# vec3 point +# int tri_index +# float distance + + +@cython.final +cdef class BVH: + cdef: + BvhNodeLeaf* leaves + BvhNodeBox* boxes + BvhNode* root + + int free_box_idx + int size + Mesh mesh + + def __cinit__(self, Mesh mesh): + self.mesh = mesh + if mesh == None: + raise ValueError + + self.size = mesh.n_triangles + self.leaves = maelloc(sizeof(BvhNodeLeaf) * self.size, __LINE__) + self.boxes = maelloc(sizeof(BvhNodeBox) * self.size, __LINE__) + self.free_box_idx = self.size + + cdef int i + with nogil: + for i in prange(self.size): + self.leaves[i].index = i + self.boxes[i].split_axis = -1; + self.boxes[i].min = vec3(INFINITY); + self.boxes[i].max = vec3(-INFINITY); + + self.mesh.update_centroids() + self.mesh.update_face_normals() + self.root = self.build_tree(self.leaves, self.size) + + def __dealloc__(self): + fraeee(self.leaves) + fraeee(self.boxes) + + cdef inline BvhNodeBox* pop_box(self) nogil: + self.free_box_idx -= 1 + # if self.free_box_idx < 0: + # raise RuntimeError('Ran out of boxes') + + return & self.boxes[self.free_box_idx] + + cdef BvhNode* build_tree(self, BvhNodeLeaf* leaves, int size) nogil: + cdef int i, j + + if size == 1: + return leaves + + cdef BvhNodeBox * box = self.pop_box() + + for i in range(size): + for j in range(3): + box.expand(self.mesh.tri_vert(leaves[i].index, j)) + + cdef vec3 median = (box.max + box.min) * 0.5 + + cdef int axis = box.major_axis() + box.set_split_axis(axis) + box.split_pos = median.v[axis] + + j = 0 + for i in range(size): + if self.mesh.centroids[leaves[i].index].v[axis] < median.v[axis]: + leaves[i].index, leaves[j].index = leaves[j].index, leaves[i].index + j += 1 + + if j == 0 or j == size: + j = size // 2 + + box.nodes[0] = self.build_tree(leaves, j) + box.nodes[1] = self.build_tree(&leaves[j], size - j) + return box + + def find_nearest(self, _p): + cdef vec3 p + p.v = _p + cdef BvhNearestResult result = self._find_nearest(p) + return (result.point.v, result.tri_index, result.distance) + + cdef inline BvhNearestResult _find_nearest(self, vec3 p) nogil: + cdef BvhNearestResult result + result.distance = INFINITY + self.find_nearest_recursive( & p, & result, self.root) + return result + + cdef void find_nearest_recursive(self, vec3* p, BvhNearestResult* out, BvhNode* node) nogil: + cdef vec3 closest + cdef int i, axis + cdef float dist + if node.is_leaf(): + i = (< BvhNodeLeaf*>node).index + closest = project_point_triangle(self.mesh.tri_vert_ptr(i, 0)[0], + self.mesh.tri_vert_ptr(i, 1)[0], + self.mesh.tri_vert_ptr(i, 2)[0], + self.mesh.face_normals[i], + p[0]) + + dist = (closest - p[0]).len_sqr() + if dist < out.distance: + out.point = closest + out.tri_index = i + out.distance = dist + + else: + dist = node.box.box_distance_sqr(p[0]) + if dist < out.distance: + # if not node.box.nodes[0].is_leaf(): + # self.find_nearest_recursive(p, out, node.box.nodes[0]) + # self.find_nearest_recursive(p, out, node.box.nodes[1]) + # return + # + # if not node.box.nodes[1].is_leaf(): + # self.find_nearest_recursive(p, out, node.box.nodes[1]) + # self.find_nearest_recursive(p, out, node.box.nodes[0]) + # return + # + # if (node.box.nodes[0].box.box_center() - p[0]).len_sqr() < (node.box.nodes[1].box.box_center() - p[0]).len_sqr(): + # self.find_nearest_recursive(p, out, node.box.nodes[0]) + # self.find_nearest_recursive(p, out, node.box.nodes[1]) + # return + axis = node.box.get_split_axis() + if node.box.split_pos > p.v[axis]: + self.find_nearest_recursive(p, out, node.box.nodes[0]) + self.find_nearest_recursive(p, out, node.box.nodes[1]) + return + self.find_nearest_recursive(p, out, node.box.nodes[1]) + self.find_nearest_recursive(p, out, node.box.nodes[0]) + + + + +cdef extern from *: + ''' + struct HalfLink { + int a; + float original_length; + float scale; + }; + + struct HalfLinkArr { + int n; + HalfLink half_links[]; + }; + ''' + + struct HalfLink: + int a + float original_length + float scale + + + struct HalfLinkArr: + int n + HalfLink half_links[0] + + +@cython.final +cdef class LinkProbe: + cdef readonly SpringLinks springs + cdef HalfLinkArr* halflinks + cdef readonly int index + + def __cinit__(self, SpringLinks springs, int index): + self.springs = springs + if index < 0 or index >= springs.engine.n_verts: + raise IndexError + + self.index = index + self.halflinks = springs.links[index] + + def __getitem__(self, int link_index): + if link_index < 0 or link_index >= self.halflinks.n: + raise IndexError + return self.halflinks.half_links[link_index].a + + def __len__(self): + return self.halflinks.n + + def __iter__(self): + cdef int i + for i in range(self.halflinks.n): + yield self.halflinks.half_links[i].a + + @property + def avg_radius(self): + cdef int i + cdef float r = 0 + for i in range(self.halflinks.n): + r += self.halflinks.half_links[i].original_length + + return r / (self.halflinks.n + EPS) + +cdef class SpringLinks: + + cdef readonly SpringEngine engine + cdef int max_links + cdef HalfLinkArr** links + + @cython.boundscheck(True) + def __cinit__(self, SpringEngine engine, list links): + self.engine = engine + self.links = maelloc(sizeof(HalfLink**) * self.engine.n_verts, __LINE__) + self.links[0] = maelloc(sizeof(HalfLinkArr) * self.engine.n_verts + sizeof(HalfLink) * 2 * len(links), __LINE__) + + cdef int a, b, i, j, n + + cdef list arranged_links = [[] for i in range(engine.n_verts)] + + for a, b in links: + arranged_links[a].append(b) + arranged_links[b].append(a) + + cdef list half_lst + + for i in range(engine.n_verts): + half_lst = arranged_links[i] + n = len(half_lst) + + if i > 0: + self.links[i] = ((self.links[i - 1]) + sizeof(HalfLinkArr) + sizeof(HalfLink) * self.links[i - 1].n) + + self.links[i].n = n + + for j in range(n): + a = half_lst[j] + self.links[i].half_links[j].a = a + + self.lengths_update() + + def __dealloc__(self): + fraeee(self.links[0]) + fraeee(self.links) + + def __getitem__(self, int key): + if key < 0 or key >= self.engine.n_verts: + raise IndexError + + return LinkProbe(self, key) + + cpdef void lengths_update(self): + cdef int i, j, a + + for i in range(self.engine.n_verts): + for j in range(self.links[i].n): + a = self.links[i].half_links[j].a + self.links[i].half_links[j].original_length = (self.engine.m.verts[i] - self.engine.m.verts[a]).len() + self.links[i].half_links[j].scale = 1 + + cpdef void smooth(self, float factor): + cdef int i, j, n + cdef HalfLink* half_links + cdef vec3 avg + + with nogil: + for i in prange(self.engine.n_verts): + n = self.links[i].n + + half_links = self.links[i].half_links + + if n == 0: + avg = self.engine.m.verts[i] + continue + + avg = vec3(0) + + for j in range(n): + avg = avg + self.engine.m.verts[half_links[j].a] + + avg = avg * 1.0 / n + + self.engine.tmp_verts[i] = self.engine.m.verts[i].lerp(avg, factor) + + self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts + + + cpdef void soft_spring_force(self, float factor, float deform_update=0.3, float deform_restore=0.03, float min_deform=0.3, float max_deform=3.0): + cdef int i, j, n, a + cdef HalfLink* half_links + cdef vec3 delta + cdef float curr_length, diff + + with nogil: + for i in prange(self.engine.n_verts): + n = self.links[i].n + + half_links = self.links[i].half_links + + self.engine.tmp_verts[i] = vec3(0) + + for j in range(n): + a = half_links[j].a + + delta = self.engine.m.verts[i] - self.engine.m.verts[a] + curr_length = nmax(delta.len(), EPS) + diff = ((half_links[j].original_length * half_links[j].scale - curr_length) / curr_length) + self.engine.tmp_verts[i] += delta * diff + half_links[j].scale = nlerp(half_links[j].scale, nclamp(curr_length / half_links[j].original_length, min_deform, max_deform), deform_update) + half_links[j].scale = nlerp(half_links[j].scale, 1, deform_restore) + + self.engine.tmp_verts[i] *= 1.0 / (n + EPS) * factor + self.engine.tmp_verts[i] += self.engine.m.verts[i] + + self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts + + cpdef void stiff_spring_force(self, float factor): + cdef int i, j, n, a + cdef HalfLink* half_links + cdef vec3 delta + cdef float curr_length, diff + with nogil: + for i in prange(self.engine.n_verts): + n = self.links[i].n + + half_links = self.links[i].half_links + + self.engine.tmp_verts[i] = vec3(0) + + for j in range(n): + a = half_links[j].a + + delta = self.engine.m.verts[i] - self.engine.m.verts[a] + curr_length = delta.len() + + diff = (half_links[j].original_length * half_links[j].scale) / curr_length + + diff = nlerp(1.0, diff, factor) + + delta = delta * diff + self.engine.tmp_verts[i] += delta + self.engine.m.verts[a] + + + self.engine.tmp_verts[i] *= 1.0 / nmax(n, 1) + + self.engine.m.verts, self.engine.tmp_verts = self.engine.tmp_verts, self.engine.m.verts + + +cdef extern from *: + ''' + struct TernaryLink { + int a, b; + int side; + float avg_dist; + }; + + struct TernaryLinkArr { + int n; + TernaryLink arr[]; + }; + ''' + + struct TernaryLink: + int a, b + int side + float avg_dist + + struct TernaryLinkArr: + int n + TernaryLink arr[0] + +@cython.final +cdef class TernarySmoothingLinks: + cdef readonly SpringEngine engine + cdef TernaryLinkArr** links + + @cython.boundscheck(True) + def __cinit__(self, SpringEngine engine, list links): + self.engine = engine + + self.links = maelloc(sizeof(TernaryLinkArr**) * engine.n_verts, __LINE__) + self.links[0] = maelloc(sizeof(TernaryLinkArr) * engine.n_verts + sizeof(TernaryLink) * len(links), __LINE__) + + cdef list arranged_links = [[] for i in range(engine.n_verts)] + + cdef int c, a, b, i, j, n + + for c, a, b in links: + arranged_links[c].append((a, b)) + + cdef list links_lst + cdef vec3 avg, d + + for i in range(engine.n_verts): + links_lst = arranged_links[i] + if i > 0: + self.links[i] = ((self.links[i - 1]) + sizeof(TernaryLinkArr) + sizeof(TernaryLink) * self.links[i - 1].n) + + n = len(links_lst) + self.links[i].n = n + + for j in range(n): + a, b = links_lst[j] + self.links[i].arr[j].a = a + self.links[i].arr[j].b = b + + + def __dealloc__(self): + fraeee(self.links[0]) + fraeee(self.links) + + cpdef void displacements_update(self): + cdef int i, j, a, b + cdef vec3 avg, d + cdef TernaryLinkArr* arr + + self.engine.m.update_face_normals() + self.engine.m.update_vert_normals() + + for i in range(self.engine.n_verts): + arr = self.links[i] + + for j in range(arr.n): + a = arr.arr[j].a + b = arr.arr[j].b + avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + d = (self.engine.m.verts[i] - avg) + arr.arr[j].side = d.dot(self.engine.m.vert_normals[i]) > 0 + arr.arr[j].avg_dist = d.len() / ((self.engine.m.verts[a] - self.engine.m.verts[b]).len() + EPS) + + cpdef void displacement_force(self, float factor): + cdef int i, j, a, b + cdef vec3 avg, d + cdef TernaryLinkArr* arr + + cdef float l + + with nogil: + for i in prange(self.engine.n_verts): + arr = self.links[i] + if arr.n == 0: + continue + + self.engine.tmp_verts[i] = vec3(0) + + for j in range(arr.n): + a = arr.arr[j].a + b = arr.arr[j].b + + avg = (self.engine.m.verts[a] + self.engine.m.verts[b]) * 0.5 + d = (self.engine.m.verts[i] - avg) + if not (d.dot(self.engine.m.vert_normals[i]) > 0) == arr.arr[j].side: + d = d - d.project_unit(self.engine.m.vert_normals[i]) * 2 + l = d.len() + if l > EPS: + l = 1 / l + d = d * l * arr.arr[j].avg_dist * (self.engine.m.verts[a] - self.engine.m.verts[b]).len() + + self.engine.tmp_verts[i] += avg + d + + self.engine.tmp_verts[i] *= 1.0 / arr.n + + for i in prange(self.engine.n_verts): + if self.links[i].n == 0: + continue + + self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.engine.tmp_verts[i], factor) + + +cdef struct QuaternaryLink: + int a, b, c, d + float ratio + int side + +cdef class QuaternarySmoothingLinks: + cdef readonly SpringEngine engine + cdef readonly int n_links + cdef QuaternaryLink* links + cdef int* accum_n + + @cython.boundscheck(True) + def __cinit__(self, SpringEngine engine, list links): + self.engine = engine + self.n_links = len(links) + self.links = maelloc(sizeof(QuaternaryLink) * self.n_links, __LINE__) + self.accum_n = caelloc(engine.n_verts, sizeof(int), __LINE__) + + cdef QuaternaryLink* lnk + cdef int i + + for i in range(self.n_links): + lnk = self.links + i + lnk.a, lnk.b, lnk.c, lnk.d = links[i] + index_check(lnk.a, engine.n_verts) + index_check(lnk.b, engine.n_verts) + index_check(lnk.c, engine.n_verts) + index_check(lnk.d, engine.n_verts) + self.accum_n[lnk.a] += 1 + self.accum_n[lnk.b] += 1 + self.accum_n[lnk.c] += 1 + self.accum_n[lnk.d] += 1 + + for i in range(engine.n_verts): + if self.accum_n[i] == 0: + self.accum_n[i] = 1 + + self.lengths_update() + + def __dealloc__(self): + fraeee(self.links) + fraeee(self.accum_n) + + cpdef void lengths_update(self): + + cdef int i + cdef QuaternaryLink* lnk + cdef vec3 ab, cd + + for i in range(self.n_links): + lnk = self.links + i + ab = (self.engine.m.verts[lnk.a] - self.engine.m.verts[lnk.b]) + cd = (self.engine.m.verts[lnk.c] - self.engine.m.verts[lnk.d]) + + lnk.ratio = ab.len() / cd.len() + lnk.side = ab.dot(cd) > 1 + + cpdef void smooth(self, float factor, float max_ratio=3): + cdef int i + cdef QuaternaryLink* lnk + cdef vec3 ab, cd + cdef float lab, lcd, rlab, rlcd + cdef float min_ratio = 1.0 / max_ratio + + for i in range(self.engine.n_verts): + self.engine.tmp_verts[i] = vec3(0) + + for i in range(self.n_links): + lnk = self.links + i + if lnk.ratio < min_ratio or lnk.ratio > max_ratio: + continue + + ab = (self.engine.m.verts[lnk.a] - self.engine.m.verts[lnk.b]) + cd = (self.engine.m.verts[lnk.c] - self.engine.m.verts[lnk.d]) + + + rlab = ab.len() + rlcd = cd.len() + + lab = rlcd * lnk.ratio + lcd = rlab / lnk.ratio + + ab -= ab / rlab * lab + cd -= cd / rlcd * lcd + + self.engine.tmp_verts[lnk.a] -= ab + self.engine.tmp_verts[lnk.b] += ab + + self.engine.tmp_verts[lnk.c] -= cd + self.engine.tmp_verts[lnk.d] += cd + + for i in range(self.engine.n_verts): + self.engine.m.verts[i] += self.engine.tmp_verts[i] * factor / self.accum_n[i] + + +@cython.final +cdef class SpringEnginePin: + cdef readonly SpringEngine engine + cdef readonly int n_rings + cdef readonly int start_index + cdef int** rings + + + def __cinit__(self, SpringLinks links, int start_index, int n_rings): + n_rings = nmax(n_rings, 1) + self.engine = links.engine + + if start_index < 0 or start_index >= self.engine.n_verts: + raise ValueError('invalid start_index') + + self.start_index = start_index + + cdef list rings = [[start_index]] + cdef set seen = set((start_index,)) + cdef list new_front + cdef LinkProbe probe + + cdef int i + cdef int vert_idx + for i in range(n_rings - 1): + new_front = [] + for vert_idx in rings[-1]: + probe = links[vert_idx] + for new_idx in probe: + if new_idx not in seen: + seen.add(new_idx) + new_front.append(new_idx) + rings.append(new_front) + + self.n_rings = n_rings + self.rings = maelloc(sizeof(int**) * self.n_rings, __LINE__) + + for i in range(self.n_rings): + self.rings[i] = NULL + + cdef list front + cdef int j + + for i, front in enumerate(rings): + self.rings[i] = maelloc(sizeof(int*) * (len(front) + 1), __LINE__) + self.rings[i][0] = len(front) + + for j in range(self.rings[i][0]): + self.rings[i][j + 1] = front[j] + + def __getitem__(self, int index): + if index < 0 or index >= self.n_rings: + raise IndexError + + def iter_ring(): + cdef int i + for i in range(self.rings[index][0]): + yield self.rings[index][i + 1] + + return iter_ring() + + def __iter__(self): + cdef int i + for i in range(self.n_rings): + yield self[i] + + def move(self, float x, float y, float z, float scale): + cdef vec3 vec = vec3(x, y, z) + cdef vec3 ring_vec + + cdef int i, j + for i in range(self.n_rings): + ring_vec = vec * nclamp((scale - i - 1) / (scale - 1), 0, 1) + for j in range(self.rings[i][0]): + self.engine.m.verts[self.rings[i][j + 1]] += ring_vec + # self.engine.prev_verts[self.rings[i][j + 1]] += ring_vec + + + def __dealloc__(self): + cdef int i + for i in range(self.n_rings): + fraeee(self.rings[i]) + fraeee(self.rings) + + +cdef class _MaskContextManager: + cdef SpringEngineMask mask + cdef float factor + cdef bint invert + + def __cinit__(self, SpringEngineMask mask, float factor, bint invert): + self.mask = mask + self.factor = factor + self.invert = invert + + def __enter__(self): + self.mask.load() + + def __exit__(self, type, value, traceback): + self.mask.masked_store(self.factor, self.invert) + + + +cdef class SpringEngineMask: + cdef float* mask + cdef vec3* vec_data + + cdef SpringEngine engine + + def __cinit__(self, SpringEngine engine, list mask): + self.engine = engine + + if not mask: + self.mask = NULL + self.vec_data = NULL + return + + elif not len(mask) == engine.n_verts: + raise ValueError('mask must have the same number of elements as engine verts') + + self.mask = maelloc(sizeof(float) * self.engine.n_verts, __LINE__) + self.vec_data = maelloc(sizeof(vec3) * self.engine.n_verts, __LINE__) + + cdef int i + for i in range(self.engine.n_verts): + self.mask[i] = mask[i] + + def __getitem__(self, int index): + if self.mask == NULL: + return 0.0 + + index_check(index, self.engine.n_verts) + return self.mask[index] + + def __setitem__(self, int index, value): + if self.mask == NULL: + return + + index_check(index, self.engine.n_verts) + self.mask[index] = value + + cpdef set_force(self, float x, float y, float z): + if self.mask == NULL: + return + + cdef int i + cdef vec3 d, v + v = vec3(x, y, z) + with nogil: + for i in prange(self.engine.n_verts): + d = self.engine.m.verts[i] - self.engine.prev_verts[i] + d = d.lerp(v, self.mask[i]) + self.engine.m.verts[i] = self.engine.prev_verts[i] + d + + cpdef void load(self): + if self.mask == NULL: + return + + cdef int i + with nogil: + for i in prange(self.engine.n_verts): + self.vec_data[i] = self.engine.m.verts[i] + + cpdef void store(self): + if self.mask == NULL: + return + + cdef int i + with nogil: + for i in prange(self.engine.n_verts): + self.engine.m.verts[i] = self.vec_data[i] + + cpdef void masked_store(self, float factor=1, bint invert=False): + if self.mask == NULL: + return + + cdef int i + with nogil: + if invert: + for i in prange(self.engine.n_verts): + self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], (1.0 - self.mask[i]) * factor) + else: + for i in prange(self.engine.n_verts): + self.engine.m.verts[i] = self.engine.m.verts[i].lerp(self.vec_data[i], self.mask[i] * factor) + + cpdef set(self, list vec_data): + if self.mask == NULL: + return + + cdef int i + if not len(vec_data) == self.engine.n_verts * 3: + raise ValueError('vec_data must have the same number of elements as engine verts times 3') + + for i in range(self.engine.n_verts * 3): + self.vec_data[i // 3].v[i % 3] = vec_data[i] + + def masked_context(self, float factor=1, bint invert=False): + return _MaskContextManager(self, factor, invert) + + def __dealloc__(self): + fraeee(self.vec_data) + fraeee(self.mask) + + + +@cython.final +cdef class SymmetryMap: + cdef int* symm_map + cdef SpringEngine engine + cdef readonly float[3] error + + def __cinit__(self, SpringEngine engine): + if engine == None: + raise ValueError + cdef BVH bvh = BVH(engine.m) + self.engine = engine + self.symm_map = maelloc(sizeof(int) * engine.n_verts * 3, __LINE__) + + cdef int i, j, axis, v_index + cdef BvhNearestResult result + cdef vec3 v + cdef double dist, tmp_dist + + self.error = (0, 0, 0) + + with nogil: + for i in prange(self.engine.n_verts): + for axis in range(3): + dist = INFINITY + v = self.engine.m.verts[i] + v.v[axis] = -v.v[axis] + + result = bvh._find_nearest(v) + for j in range(3): + v_index = self.engine.m.triangles[result.tri_index][j] + tmp_dist = (self.engine.m.verts[v_index] - v).len() + if tmp_dist < dist: + dist = tmp_dist + self.symm_map[i + self.engine.m.n_verts * axis] = v_index + self.error[axis] = nmax(dist, self.error[axis]) + + def __getitem__(self, int index): + if index < 0 or index >= self.engine.n_verts: + raise KeyError + + return tuple(self.symm_map[index + axis * self.engine.n_verts] for axis in range(3)) + + cpdef void mirror(self, bint x, bint y, bint z): + cdef int i, j, axis, v_index + cdef int[3] mirror = (x, y, z) + cdef vec3 v + + with nogil: + for axis in range(3): + if not mirror[axis]: + continue + + for i in prange(self.engine.n_verts): + v_index = self.symm_map[i + axis * self.engine.m.n_verts] + v = self.engine.m.verts[v_index] + v.v[axis] = -v.v[axis] + self.engine.tmp_verts[i] = (self.engine.m.verts[i] + v) * 0.5 + + self.engine.tmp_verts, self.engine.m.verts = self.engine.m.verts, self.engine.tmp_verts + + def __dealloc__(self): + fraeee(self.symm_map) + + +cdef class SpringEngine: + cdef Mesh m + cdef vec3* prev_verts + cdef vec3* tmp_verts + cdef BVH bvh + cdef int* bvh_closest_indexes + cdef unsigned int snap_count + + cdef int n_verts + + def __init__(self, Mesh m, BVH bvh=None): + self.m = m + self.n_verts = m.n_verts + self.snap_count = 0 + self.prev_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + self.tmp_verts = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + self.bvh_closest_indexes = maelloc(sizeof(vec3) * self.n_verts, __LINE__) + cdef int i + for i in range(self.n_verts): + self.prev_verts[i] = self.m.verts[i] + + self.set_bvh(bvh) + + cpdef void set_bvh(self, BVH bvh): + self.bvh = bvh + + cdef int i + if bvh: + with nogil: + for i in prange(self.n_verts): + self.bvh_closest_indexes[i] = -1 + + def __dealloc__(self): + fraeee(self.prev_verts) + fraeee(self.tmp_verts) + fraeee(self.bvh_closest_indexes) + + def __len__(self): + return self.n_verts * 3 + + def __getitem__(self, int key): + return self.m.verts[key // 3].v[key % 3] + + def __setitem__(self, int key, float v): + self.m.verts[key // 3].v[key % 3] = v + self.prev_verts[key // 3].v[key % 3] = v + + def from_list(self, list items): + if not len(items) >= self.n_verts * 3: + raise ValueError('list too small') + + cdef int i + for i in range(self.n_verts * 3): + self.m.verts[i // 3].v[i % 3] = items[i] + self.prev_verts[i // 3].v[i % 3] = items[i] + + def set_verts(self, list indexes, list locations): + cdef int i, index + cdef float x, y, z + if not len(indexes) == len(locations): + raise ValueError('indexes array is not the same size as locations array') + + for i in range(len(indexes)): + index = indexes[i] + x, y, z = locations[i] + self.prev_verts[index] = self.m.verts[index] = vec3(x, y, z) + + def get_verts(self, list indexes): + cdef int i, index + cdef list ret = [] + for i in range(len(indexes)): + index = indexes[i] + if index < 0 or index >= self.n_verts: + raise IndexError + ret.append(self.m.verts[index].v) + return ret + + def move_verts(self, list indexes, float x, float y, float z): + cdef vec3 delta = vec3(x, y, z) + cdef int i, index + for i in range(len(indexes)): + index = indexes[i] + if index < 0 or index >= self.n_verts: + raise IndexError + self.m.verts[index] += delta + self.prev_verts[index] += delta + + def snap_to_bvh(self, float factor=1, int cycle_quality=10, str snapping_mode='SURFACE'): + cdef int snapping_mode_ = {'SURFACE': 1, + 'OUTSIDE': 2, + 'INSIDE': 4}[snapping_mode] + + if not self.bvh: + raise RuntimeError('No bvh avaliable') + + cycle_quality = nabs(cycle_quality) + self.snap_count += 1 + + cdef BvhNearestResult result + cdef int i + cdef vec3 v + cdef float snapping + cdef unsigned int cycle + + with nogil: + for i in prange(self.n_verts): + cycle = (i ^ 0x243F6A88) * 0x243F6A88 + cycle = cycle ^ cycle >> 5 + cycle = cycle + self.snap_count + + if cycle % cycle_quality > 0 and self.bvh_closest_indexes[i] >= 0: + result.tri_index = self.bvh_closest_indexes[i] + result.point = project_point_plane( + self.m.verts[i], + self.bvh.mesh.verts[self.bvh.mesh.triangles[result.tri_index][0]], + self.bvh.mesh.face_normals[result.tri_index] + ) + else: + result = self.bvh._find_nearest(self.m.verts[i]) + self.bvh_closest_indexes[i] = result.tri_index + + v = result.point - self.m.verts[i] + + if snapping_mode_ & 1: + if v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0: + if v.dot(self.m.vert_normals[i]) < 0: + v = self.m.vert_normals[i] * v.len() + v * 0.5 + + + snapping = self.m.vert_normals[i].dot(self.bvh.mesh.face_normals[result.tri_index]) + snapping = snapping * snapping + + v = v * factor * snapping + self.m.verts[i] += v + + elif snapping_mode_ & (2 | 4): + if (v.dot(self.bvh.mesh.face_normals[result.tri_index]) > 0) ^ (snapping_mode_ & 4 > 0): + v = self.m.verts[i] = result.point + + cpdef SpringLinks create_spring_group(self, list links): + return SpringLinks(self, links) + + cpdef SymmetryMap create_symmetry_map(self): + return SymmetryMap(self) + + cpdef TernarySmoothingLinks create_ternary_links(self, list links): + return TernarySmoothingLinks(self, links) + + cpdef QuaternarySmoothingLinks create_quaternary_links(self, list links): + return QuaternarySmoothingLinks(self, links) + + cpdef SpringEngineMask create_mask(self, mask): + return SpringEngineMask(self, mask) + + cpdef void random_verts(self, float factor, unsigned int seed=0x452821E6): + cdef int i + cdef unsigned int xorstate = 0x452821E6 + cdef vec3 v + with nogil: + for i in prange(self.n_verts): + v = vec3(xorshiftf(&xorstate), xorshiftf(&xorstate), xorshiftf(&xorstate)) * factor + self.m.verts[i] += v + self.prev_verts[i] += v + + cpdef void kinetic_step(self, float damping): + cdef int i + + with nogil: + for i in prange(self.n_verts): + self.tmp_verts[i] = (self.m.verts[i] - self.prev_verts[i]) * damping + self.m.verts[i] + + self.prev_verts, self.m.verts, self.tmp_verts = self.m.verts, self.tmp_verts, self.prev_verts + + cpdef void update_mesh_normals(self, float factor): + self.tmp_verts, self.m.vert_normals = self.m.vert_normals, self.tmp_verts + + self.m.update_face_normals() + self.m.update_vert_normals() + + cdef int i + if factor < 1: + with nogil: + for i in prange(self.n_verts): + self.m.vert_normals[i] = self.tmp_verts[i].lerp(self.m.vert_normals[i], factor) diff --git a/softwrap2/draw_3d.py b/softwrap2/draw_3d.py new file mode 100644 index 0000000..d2f1a3e --- /dev/null +++ b/softwrap2/draw_3d.py @@ -0,0 +1,239 @@ +# Copyright (C) 2021 Jean Da Costa machado. +# Jean3dimensional@gmail.com +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +''' +This is a utility module for drawing lines in the 3D viewport on Blender 2.8 +using the GPU Api + + +The idea is to get rid of messy draw functions and data that is hard to keep track. +This class works directly like a callable draw handler and keeps track of all the geometry data. +''' + +__all__ = ["DrawCallback"] + +import bpy +import bgl +import gpu +from gpu_extras.batch import batch_for_shader +from mathutils import Matrix, Vector +VERSION = bpy.app.version + +vertex_shader = ''' + +uniform mat4 ModelViewProjectionMatrix; + +#ifdef USE_WORLD_CLIP_PLANES +uniform mat4 ModelMatrix; +#endif + +in vec3 pos; +in vec4 color; + +out vec4 finalColor; + +void main() +{ + gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); + gl_Position.z -= 0.002; + finalColor = color; + + #ifdef USE_WORLD_CLIP_PLANES + world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz); + #endif +} + +''' + + +fragment_shader = """ +in vec4 finalColor; +out vec4 fragColor; + +void main() +{ + fragColor = finalColor; + fragColor = blender_srgb_to_framebuffer_space(fragColor); +} +""" + +point_fragment_shader = """ +in vec4 finalColor; +in vec4 fragCoord; + +out vec4 fragColor; + +void main() +{ + vec2 coord = (gl_PointCoord - vec2(0.5, 0.5)) * 2.0; + float fac = dot(coord, coord); + if (fac > 0.5){ + discard; + } + fragColor = finalColor; + fragColor = blender_srgb_to_framebuffer_space(fragColor); +} + +""" + + +class DrawCallback: + running_draws = set() + + def __init__(self): + + # Useful for rendering in the same space of an object + self.matrix = Matrix().Identity(4) + # X-ray mode, draw through solid objects + self.draw_on_top = False + # Blend mode to choose, set it to one of the blend constants. + self.blend_mode = 'MULTIPLY' + + self.line_width = 1 + self.point_size = 3 + + # Handler Placeholder + self.draw_handler = None + + self.line_coords = [] + self.line_colors = [] + self.point_coords = [] + self.point_colors = [] + self._line_shader = gpu.types.GPUShader(vertex_shader, fragment_shader) + self._point_shader = gpu.types.GPUShader(vertex_shader, point_fragment_shader) + self._line_batch = batch_for_shader(self._line_shader, 'LINES', + {"pos": self.line_coords, "color": self.line_colors}) + self._point_batch = batch_for_shader(self._line_shader, 'POINTS', + {"pos": self.point_coords, "color": self.line_colors}) + + def __call__(self, *args, **kwargs): + # __call__ Makes this object behave like a function. + # So you can add it like a draw handler. + self._draw() + + def setup_handler(self): + # Utility function to easily add it as a draw handler + self.draw_handler = bpy.types.SpaceView3D.draw_handler_add(self, (), "WINDOW", "POST_VIEW") + self.__class__.running_draws.add(self) + + def remove_handler(self): + # Utility function to remove the handler + if not self.draw_handler: + return + bpy.types.SpaceView3D.draw_handler_remove(self.draw_handler, "WINDOW") + self.draw_handler = None + self.__class__.running_draws.remove(self) + + @classmethod + def remove_all_handlers(cls): + for draw in list(cls.running_draws): + draw.remove_handler() + + def update_batch(self): + # This takes the data rebuilds the shader batch. + # Call it every time you clear the data or add new lines, otherwize, + # You wont see changes in the viewport + coords = [self.matrix @ Vector(coord) for coord in self.line_coords] + self._line_batch = batch_for_shader(self._line_shader, 'LINES', {"pos": coords, "color": self.line_colors}) + coords = [self.matrix @ Vector(coord) for coord in self.point_coords] + self._point_batch = batch_for_shader(self._point_shader, 'POINTS', {"pos": coords, "color": self.point_colors}) + + def add_line(self, start, end, color1=(1, 0, 0, 1), color2=None): + # Simple add_line function, support color gradients, + # if only color1 is specified, it will be solid color (color1 on both ends) + # This doesnt render a line, it just adds the vectors and colors to the data + # so after calling update_batch(), it will be converted in a buffer Object + self.line_coords.append(Vector(start)) + self.line_coords.append(Vector(end)) + self.line_colors.append(color1) + if color2 is None: + self.line_colors.append(color1) + else: + self.line_colors.append(color2) + + def add_point(self, location, color=(1, 0, 0, 1)): + self.point_coords.append(location) + self.point_colors.append(color) + + def clear_data(self): + # just clear all the data + self.line_coords = [] + self.line_colors = [] + self.point_coords = [] + self.point_colors = [] + + def _start_drawing(self): + # This handles all the settings of the renderer before starting the draw stuff + if VERSION[1] >= 93: + gpu.state.blend_set('ALPHA') + + # bgl.glDisable(bgl.GL_DEPTH_TEST) + # if self.draw_on_top: + if self.draw_on_top: + gpu.state.depth_test_set('NONE') + + gpu.state.line_width_set(self.line_width) + gpu.state.point_size_set(self.point_size) + + else: + bgl.glEnable(bgl.GL_BLEND) + + if self.draw_on_top: + bgl.glDisable(bgl.GL_DEPTH_TEST) + + bgl.glLineWidth(self.line_width) + bgl.glPointSize(self.point_size) + + def _stop_drawing(self): + + # just reset some OpenGL stuff to not interfere with other drawings in the viewport + # its not absolutely necessary but makes it safer. + if VERSION[1] >= 93: + pass + + else: + bgl.glDisable(bgl.GL_BLEND) + bgl.glLineWidth(1) + bgl.glPointSize(1) + if self.draw_on_top: + bgl.glEnable(bgl.GL_DEPTH_TEST) + + def _draw(self): + # This should be called by __call__, + # just regular routines for rendering in the viewport as a draw_handler + self._start_drawing() + self._line_shader.bind() + self._line_batch.draw(self._line_shader) + self._point_shader.bind() + self._point_batch.draw(self._point_shader) + self._stop_drawing() + + +if __name__ == "__main__": + # Simple example, run it on blender's text editor. + + # create a new instance of the class + draw = DrawCallback() + # add lines to ir + draw.add_line((10, 0, 0), (-10, 0, 0), color1=(1, 0, 0, 1), color2=(0, 0, 1, 1)) + draw.add_line((0, 0, 0), (0, 0, 5), color1=(0, 1, 0, 1), color2=(0, 1, 1, 1)) + # enable X ray mode/see through objects and set Blend mode to Additive + draw.draw_on_top = True + draw.blend_mode = ADDITIVE_BLEND + # set line width to 5 + draw.line_width = 5 + # Important, update batch always when adding + # new lines, otherwize they wont render. + draw.update_batch() + # setup draw handler, optionally, you can call bpy.SpaceView3D.draw_handler_add() + draw.setup_handler() diff --git a/softwrap2/setup.py b/softwrap2/setup.py new file mode 100644 index 0000000..b199f5e --- /dev/null +++ b/softwrap2/setup.py @@ -0,0 +1,111 @@ +# Copyright (C) 2021 Jean Da Costa machado. +# Jean3dimensional@gmail.com +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +from setuptools import setup, Extension +from Cython.Build import cythonize +from distutils.util import get_platform +import re +from sys import argv +from os import path + +debug = 'debug' in argv +if debug: + argv.remove('debug') + +platf = get_platform().lower() +print(f'compiling for platform: {platf}') +if 'linux' in platf: + extra_compile_args = ['-ffast-math', '-fopenmp', '-O3'] + (['-g3'] if debug else []) + extra_link_args = ['-fopenmp'] + (['-g3'] if debug else []) + +elif 'win' in platf: + extra_compile_args = ['/O2', '/openmp', '/fp:fast'] + (['/debug'] if debug else []) + extra_link_args = ['/openmp'] + (['/debug'] if debug else []) + +else: # mac + extra_compile_args = ['-ffast-math', '-O3', '-std=c++2a'] + (['-g3'] if debug else []) + extra_link_args = ['-g3'] if debug else [] + + + +def line_directive_add(filestr): + modfied_tag = '/* Postprocessed to add #line directives */' + if filestr.startswith(modfied_tag): + return filestr + + lines = filestr.split('\n') + line_comment_re = re.compile(r"^\s*\/\*\s*\"(.+)\":(\d+)") + define_re = re.compile(r'\s*#\s*define') + + curr_line = None + curr_file = None + in_comment = False + in_define = False + + new_lines = [modfied_tag] + for line in lines: + if "/*" in line: + in_comment = True + curr_file = None + curr_line = None + + match = line_comment_re.match(line) + if match: + filename = match.group(1) + line_num = match.group(2) + if path.isfile(filename): + # curr_file = path.abspath(filename) + curr_file = filename + curr_line = line_num + + if define_re.match(line): + in_define = True + + if not in_comment and not in_define and line.strip(): + if curr_file: + new_lines.append(f'\n# line {curr_line} "{curr_file}"') + + if '*/' in line: + in_comment = False + + if not line.endswith('\\'): + in_define = False + + new_lines.append(line) + + return '\n'.join(new_lines) + '\n' + + +modules = cythonize( + Extension( + 'softwrap_core2', + # ['core/core.pyx'], + ['core/core2.pyx'], + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + include_dirs=["core"] + ) +) + +print('adding #line directives') +with open('core/core2.cpp', 'r+') as f: + new_filestr = line_directive_add(f.read()) + f.seek(0) + f.truncate() + f.write(new_filestr) + +setup( + name='softwrap_core2', + ext_modules=modules +) diff --git a/softwrap2/softwrap_core2.cp310-win_amd64.pyd b/softwrap2/softwrap_core2.cp310-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..0ca96364d04667123fa6fceb7cf4a967cbcfb983 GIT binary patch literal 195584 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