pysdic.Connectivity.to_npz#

Connectivity.to_npz(filepath, save_properties=True)[source]#

Save the connectivity to a NumPy NPZ file.

The elements will be saved as an array named ‘elements’ with shape \((N_e, N_{vpe})\). Additional properties will be saved as separate arrays in the NPZ file with names in the format "_properties/{property_name}".

See also

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

  • save_properties (bool, optional) – If True, all properties of the connectivity will be saved as separate arrays in the NPZ file. Default is True.

Return type:

None

Examples

Saving a Connectivity object to a NPZ file.

1from pysdic import PointCloud
2import numpy as np
3
4# Create a random connectivity with 100 elements
5random_elements = np.random.randint(0, 100, size=(100, 4))  # shape (100, 4)
6connectivity = Connectivity.from_array(random_elements)
7
8# Save the connectivity to a NPZ file
9connectivity.to_npz('path/to/output_connectivity.npz')

This will save the elements and properties of the connectivity to the specified NPZ file.