Skip to content

Commit

Permalink
reduce chunk size for mesh point calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
mogres committed Sep 14, 2023
1 parent 91f4f17 commit 4d6787a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cellpack/autopack/MeshStore.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import trimesh
from cellpack import autopack

CHUNK_SIZE = 100000
CHUNK_SIZE = 50000


class MeshStore:
Expand Down Expand Up @@ -261,6 +261,7 @@ def contains_point(self, geomname, point):

def contains_points_mesh(self, geomname, points):
mesh = self.get_object(geomname)
inside = numpy.full(len(points), False)
if mesh is not None:
if len(points) <= CHUNK_SIZE:
return mesh.contains(points) # TODO: check for memory leak
Expand All @@ -273,7 +274,7 @@ def contains_points_mesh(self, geomname, points):
else:
inside = numpy.append(inside, mesh.contains(chunk))
return inside
return numpy.full(len(points), False)
return inside

def get_smallest_radius(self, geomname, center):
mesh = self.get_object(geomname)
Expand Down

0 comments on commit 4d6787a

Please sign in to comment.