Commit 046058d3 authored by sumpfralle's avatar sumpfralle

switched back to tuple as parameter for parallelized functions (necessary for...

switched back to tuple as parameter for parallelized functions (necessary for "imap" function in multiprocessing)
fixed small issues of the "cutter.moveto/cutter.drop" transition


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@750 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent ebcd92c9
...@@ -56,22 +56,22 @@ class BaseCutter(object): ...@@ -56,22 +56,22 @@ class BaseCutter(object):
def get_minx(self, start=None): def get_minx(self, start=None):
if start is None: if start is None:
start = self.location start = self.location
return self.location.x - self.distance_radius return start.x - self.distance_radius
def get_maxx(self, start=None): def get_maxx(self, start=None):
if start is None: if start is None:
start = self.location start = self.location
return self.location.x + self.distance_radius return start.x + self.distance_radius
def get_miny(self, start=None): def get_miny(self, start=None):
if start is None: if start is None:
start = self.location start = self.location
return self.location.y - self.distance_radius return start.y - self.distance_radius
def get_maxy(self, start=None): def get_maxy(self, start=None):
if start is None: if start is None:
start = self.location start = self.location
return self.location.y + self.distance_radius return start.y + self.distance_radius
def update_uuid(self): def update_uuid(self):
self.uuid = uuid.uuid4() self.uuid = uuid.uuid4()
...@@ -131,7 +131,7 @@ class BaseCutter(object): ...@@ -131,7 +131,7 @@ class BaseCutter(object):
* triangle.radius + triangle.radiussq) + epsilon: * triangle.radius + triangle.radiussq) + epsilon:
return None return None
(cl, d, cp) = self.intersect(BaseCutter.vertical, triangle) (cl, d, cp) = self.intersect(BaseCutter.vertical, triangle, start=start)
return cl return cl
def intersect_circle_triangle(self, direction, triangle, start=None): def intersect_circle_triangle(self, direction, triangle, start=None):
......
...@@ -181,7 +181,7 @@ class ToroidalCutter(BaseCutter): ...@@ -181,7 +181,7 @@ class ToroidalCutter(BaseCutter):
continue continue
p = edge.point_with_length_multiply(m) p = edge.point_with_length_multiply(m)
(cl, ccp, cp, l) = self.intersect_torus_point(direction, p, (cl, ccp, cp, l) = self.intersect_torus_point(direction, p,
start=None) start=start)
if not cl: if not cl:
continue continue
if l < min_l: if l < min_l:
......
...@@ -45,7 +45,7 @@ log = pycam.Utils.log.get_logger() ...@@ -45,7 +45,7 @@ log = pycam.Utils.log.get_logger()
# We need to use a global function here - otherwise it does not work with # We need to use a global function here - otherwise it does not work with
# the multiprocessing Pool. # the multiprocessing Pool.
def _process_one_triangle(model, cutter, up_vector, triangle, z): def _process_one_triangle((model, cutter, up_vector, triangle, z)):
result = [] result = []
# ignore triangles below the z level # ignore triangles below the z level
if triangle.maxz < z: if triangle.maxz < z:
......
...@@ -33,8 +33,8 @@ log = pycam.Utils.log.get_logger() ...@@ -33,8 +33,8 @@ log = pycam.Utils.log.get_logger()
# We need to use a global function here - otherwise it does not work with # We need to use a global function here - otherwise it does not work with
# the multiprocessing Pool. # the multiprocessing Pool.
def _process_one_grid_line(positions, minz, maxz, dim_attrs, model, cutter, def _process_one_grid_line((positions, minz, maxz, dim_attrs, model, cutter,
physics, safety_height): physics, safety_height)):
# for now only used for triangular collision detection # for now only used for triangular collision detection
last_position = None last_position = None
points = [] points = []
......
...@@ -31,7 +31,7 @@ import math ...@@ -31,7 +31,7 @@ import math
# We need to use a global function here - otherwise it does not work with # We need to use a global function here - otherwise it does not work with
# the multiprocessing Pool. # the multiprocessing Pool.
def _process_one_line(p1, p2, depth, model, cutter, physics): def _process_one_line((p1, p2, depth, model, cutter, physics)):
if physics: if physics:
points = get_free_paths_ode(physics, p1, p2, depth=depth) points = get_free_paths_ode(physics, p1, p2, depth=depth)
else: else:
......
...@@ -253,7 +253,7 @@ def _handle_tasks(tasks, results, stats, cache, closing): ...@@ -253,7 +253,7 @@ def _handle_tasks(tasks, results, stats, cache, closing):
real_args.append(arg) real_args.append(arg)
stats.add_transfer_time(name, time.time() - start_time) stats.add_transfer_time(name, time.time() - start_time)
start_time = time.time() start_time = time.time()
results.put((job_id, task_id, func(*real_args))) results.put((job_id, task_id, func(real_args)))
stats.add_process_time(name, time.time() - start_time) stats.add_process_time(name, time.time() - start_time)
except Queue.Empty: except Queue.Empty:
time.sleep(1.0) time.sleep(1.0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment