Skip to content
Snippets Groups Projects
Commit ed4141e2 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Raise an error if compact generator with different radii is used

parent 33ce0d93
No related branches found
No related tags found
No related merge requests found
......@@ -378,6 +378,9 @@ def load_model(model_file):
rnd_engine = "COMPACT"
if (rnd_engine == "COMPACT"):
check = random_compact(sconf, gconf, rnd_seed, max_rad)
if (check == 1):
print("ERROR: compact random generator works only when all sphere types have the same radius.")
return (None, None)
elif (rnd_engine == "LOOSE"):
check = random_aggregate(sconf, gconf, rnd_seed, max_rad)
else:
......@@ -782,13 +785,13 @@ def random_compact(scatterer, geometry, seed, max_rad):
# mesh = pv.Sphere(radius / max_rad, (x, y, z))
# pl.add_mesh(mesh)
#pl.export_obj("scene.obj")
sph_index = 0
for sphere in sorted(vec_spheres, key=lambda item: item['itype']):
scatterer['vec_types'][sph_index] = sphere['itype']
geometry['vec_sph_x'][sph_index] = sphere['x']
geometry['vec_sph_y'][sph_index] = sphere['y']
geometry['vec_sph_z'][sph_index] = sphere['z']
sph_index += 1
sph_index = 0
for sphere in sorted(vec_spheres, key=lambda item: item['itype']):
scatterer['vec_types'][sph_index] = sphere['itype']
geometry['vec_sph_x'][sph_index] = sphere['x']
geometry['vec_sph_y'][sph_index] = sphere['y']
geometry['vec_sph_z'][sph_index] = sphere['z']
sph_index += 1
return result
## \brief Write the geometry configuration dictionary to legacy format.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment