summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2013-05-07 09:40:39 -0400
committertlatorre <tlatorre@uchicago.edu>2021-05-09 08:42:39 -0700
commit5db9a0b51b93848c149d48c697f24c640bc33d4b (patch)
tree9eb0efa04c85deaf152a0ab779ec5ac8b465609c
parent8549ed651b060f5d42358086085afc0b3d885dc4 (diff)
downloadchroma-5db9a0b51b93848c149d48c697f24c640bc33d4b.tar.gz
chroma-5db9a0b51b93848c149d48c697f24c640bc33d4b.tar.bz2
chroma-5db9a0b51b93848c149d48c697f24c640bc33d4b.zip
Set dtype explicitly when making morton codes
-rw-r--r--chroma/bvh/grid.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/chroma/bvh/grid.py b/chroma/bvh/grid.py
index d8e1f38..6f4c146 100644
--- a/chroma/bvh/grid.py
+++ b/chroma/bvh/grid.py
@@ -68,7 +68,9 @@ def make_recursive_grid_bvh(mesh, target_degree=3):
new_parent_morton_parts.extend([np.repeat(morton_part[0],
len(extra_first)), morton_part[1:]])
- parent_morton_codes = np.concatenate(new_parent_morton_parts)
+ # Explicitly cast all lists to uint64 dtype to ensure final array has correct type
+ # (Empty array is implicitly float64 dtype)
+ parent_morton_codes = np.concatenate([p.astype(np.uint64) for p in new_parent_morton_parts])
first_child = np.concatenate(new_first_child_parts)
nchild = np.ediff1d(first_child, to_end=nnodes - first_child[-1]).astype(np.uint32)