stellarmesh.Mesh

class Mesh(mesh_filename: str | bytes | PathLike | None = None)Source

A Gmsh mesh.

As Gmsh allows for only a single process, this class provides a context manager to set the Gmsh API to operate on this mesh.

entity_metadata(dim: Literal[2], tag: int) SurfaceMetadataSource
entity_metadata(dim: Literal[3], tag: int) VolumeMetadata

Get metadata for an entity.

Parameters:
  • dim – Entity dimension.

  • tag – Entity tag.

Returns:

Entity metadata.

render(output_filename: str | None = None, rotation_xyz: tuple[float, float, float] = (0, 0, 0), normals: int = 0, *, clipping: bool = True) strSource

Render mesh as an image.

Parameters:
  • output_filename – Optional output filename. Defaults to None.

  • rotation_xyz – Rotation in Euler angles. Defaults to (0, 0, 0).

  • normals – Normal render size. Defaults to 0.

  • clipping – Whether to enable mesh clipping. Defaults to True.

Returns:

Path to image file, either passed output_filename or a temporary file.

write(filename: str | bytes | PathLike, *, save_all: bool = True, use_meshio: bool = False)Source

Write mesh to a file.

If Gmsh cannot handle the file format, writing will be deferred to meshio.

Parameters:
  • filename – Path to write file.

  • save_all – Whether to save all entities (or just physical groups). See

  • True. (Gmsh documentation for Mesh.SaveAll. Defaults to)

  • use_meshio – Write mesh with meshio instead of the builtin exporters.

  • formats. (Meshio supports more unstructured mesh)