pysdic.Mesh.to_npz#
- Mesh.to_npz(filename, save_properties=True)[source]#
Write the
Meshinstance 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
Mesh.from_npz()for the reverse operation.numpy documentation for more information.
- Parameters:
- Raises:
ValueError – If the file format is not supported or the mesh is empty.
- Return type:
None
Examples
Create a simple
Meshinstance.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
Meshinstance to a NPZ file.1mesh3d.to_npz("simple_mesh.npz") 2# This will create a file named 'simple_mesh.npz' in the current directory.