Mondaic

salvus.mesh.algorithms.connectivity

salvus.mesh.algorithms.connectivity salvus mesh algorithms connectivity

Connectivity helpers.

Functions

compact_indices()

def compact_indices(global_connectivity: npt.NDArray) -> npt.NDArray: ...

Convert global connectivity indices to compact local indices.

Parameters
  • global_connectivity npt.NDArray — Connectivity array with global indices.
Returns npt.NDArray — Connectivity array with local indices (0-based sequential numbering).

get_connectivity_permutation()

def get_connectivity_permutation(
    n_dim: typing.Literal[2, 3],
    model_order: int,
    permutation: Permutation = Permutation.DMPlex,
) -> (
    tuple[npt.NDArray, npt.NDArray, npt.NDArray]
    | tuple[npt.NDArray, npt.NDArray, npt.NDArray, npt.NDArray]
): ...

Get the connectivity permutation for varying dimension and model order.

Depending on the permutation and dimension, this function will map a tensor product connectivity array to:

n_dim = 2:
    - Permutation.DMPlex: [cells, vertices, edges]
    - Permutation.VTK: [vertices, edges, cells]

n_dim = 3:
    - Permutation.DMPlex: [cells, vertices, edges, facets]
    - Permutation.VTK: [vertices, edges, facets, cells]
Parameters
  • n_dim typing.Literal[2, 3] — The dimension of the mesh.
  • model_order int — The model order of the mesh.
  • permutation Permutation — The desired permutation.
Returns tuple[npt.NDArray, npt.NDArray, npt.NDArray] | tuple[npt.NDArray, npt.NDArray, npt.NDArray, npt.NDArray] — The connectivity permutation array.

get_connectivity_permutation_2d()

def get_connectivity_permutation_2d(
    model_order: int,
) -> tuple[npt.NDArray, npt.NDArray, npt.NDArray]: ...

Get the connectivity permutation for a 2D quadrilateral mesh.

Permutes element connectivity from a tensor product order [r x s] with r varying fastest, to a VTK Lagrange ordering. To get the inverse permutation (VTK Lagrange ordering -> tensor product ordering), simply run np.argsort on the result.

Parameters
  • model_order int — The model order.
Returns tuple[npt.NDArray, npt.NDArray, npt.NDArray] — The connectivity permutation array.

get_connectivity_permutation_3d()

def get_connectivity_permutation_3d(
    model_order: int,
) -> tuple[npt.NDArray, npt.NDArray, npt.NDArray, npt.NDArray]: ...

Get the connectivity permutation for a 3D hexahedral mesh.

Permutes element connectivity from a tensor product order [r x s x t] with r varying fastest, to a VTK Lagrange ordering. To get the inverse permutation (VTK Lagrange ordering -> tensor product ordering), simply run np.argsort on the result.

Parameters
  • model_order int — The model order.
Returns tuple[npt.NDArray, npt.NDArray, npt.NDArray, npt.NDArray] — The connectivity permutation array.

interior_slice()

def interior_slice(ndim: int) -> tuple[slice, ...]: ...

Get the interior slice for a given number of dimensions.

Parameters
  • ndim int — The number of dimensions.
Returns tuple[slice, ...] — A tuple of slice objects for the interior of each dimension.

Classes

Permutation

class Permutation(enum.Enum):
    def __init__(self): ...

Enum for different types of connectivity permutations.