pysdic.Mesh.to_npz#

Mesh.to_npz(filename, save_properties=True)[source]#

Write the Mesh instance to a NPZ file.

The mesh must not be empty.

This method uses numpy to write the Mesh instance to a NPZ file.

See also

Parameters:
  • filename (str) – The path to the output NPZ file.

  • save_properties (bool, optional) – If True, properties are saved to the NPZ file, by default True.

Raises:

ValueError – If the file format is not supported or the mesh is empty.

Return type:

None

Examples

Create a simple Mesh instance.

1import numpy as np
2from pysdic import Mesh, PointCloud
3points = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]])
4connectivity = np.array([[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]])
5mesh3d = Mesh(points, connectivity, element_type="triangle_3")

Save the Mesh instance to a NPZ file.

1mesh3d.to_npz("simple_mesh.npz")
2# This will create a file named 'simple_mesh.npz' in the current directory.