treams.io.mesh_spheres¶
- treams.io.mesh_spheres(radii, positions, model, meshsize=None, meshsize_boundary=None)¶
Generate a mesh of multiple spheres.
This function facilitates generating a mesh for a cluster spheres using gmsh. It requires the package gmsh to be installed.
Examples
>>> import gmsh >>> import treams.io >>> gmsh.initialize() >>> gmsh.model.add("spheres") >>> treams.io.mesh_spheres([1, 2], [[0, 0, 2], [0, 0, -2]], gmsh.model) <class 'gmsh.model'> >>> gmsh.write("spheres.msh") >>> gmsh.finalize()
- Parameters:
radii (float, array_like) – Radii of the spheres.
positions (float, (N, 3)-array) – Positions of the spheres.
model (gmsh.model) – Gmsh model to modify.
meshsize (float, optional) – Mesh size, if None a fifth of the largest radius is used.
meshsize – Mesh size of the surfaces, if left empty it is set equal to the general mesh size.
- Returns:
gmsh.model