We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f37b071 commit 2de707bCopy full SHA for 2de707b
src/kanapy/voxelization.py
@@ -379,8 +379,16 @@ def poly2vox():
379
for igr, vlist in mesh.grain_dict.items():
380
vlist = np.array(vlist) - 1
381
gr_arr[vlist] = igr
382
+ ind = np.nonzero(gr_arr == 0)[0]
383
+ if len(ind) > 0:
384
+ # some voxels have not been assigned to grains, check is assignment is required
385
+ if prec_vf is None:
386
+ for iv in ind:
387
+ gr_arr[iv] = gr_arr[iv-1] # assign voxel to neighbor grain
388
+ print(f'Warning: Assigned voxel {iv} to grain {gr_arr[iv-1]}.')
389
mesh.grains = np.reshape(gr_arr, mesh.dim, order='C')
390
391
+
392
# generate array of voxelized structure with phase numbers
393
# and dict of phase numbers for each grain
394
# empty voxels will get phase number 1 and be assigned to grain with key 0
0 commit comments