uxarray.grid.connectivity._face_nodes_to_sparse_matrix

uxarray.grid.connectivity._face_nodes_to_sparse_matrix#

uxarray.grid.connectivity._face_nodes_to_sparse_matrix(dense_matrix)#

Converts a given dense matrix connectivity to a sparse matrix format where the locations of non fill-value entries are stored using COO (coordinate list) standard. It is represented by three arrays: row indices, column indices, and non-filled element flags. :param dense_matrix: The dense matrix to be converted. :type dense_matrix: np.ndarray

Returns:

A tuple containing three arrays: - face_indices : np.ndarray

Array containing the face indices for each non fill-value element.

  • node_indicesnp.ndarray

    Array containing the node indices for each non fill-value element.

  • non_filled_elements_flagnp.ndarray

    Array containing flags indicating if a non fill-value element is present in the corresponding row and column index.

Return type:

tuple

Example

>>> face_nodes_conn = np.array([[3, 4, 5, INT_FILL_VALUE],
...                             [3, 0, 2, 5],
...                             [3, 4, 1, 0],
...                             [0, 1, 2, -999]])
>>> face_indices, nodes_indices, non_filled_flag = _face_nodes_to_sparse_matrix(face_nodes_conn)
>>> face_indices = np.array([0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3])
>>> nodes_indices = np.array([3, 4, 5, 3, 0, 2, 5, 3, 4, 1, 0, 0, 1, 2])
>>> non_filled_flag = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])