quickpaver.span_to_node_numbers_2d#
- quickpaver.span_to_node_numbers_2d(span: ndarray[tuple[Any, ...], dtype[int64]] | Tuple[slice, slice] | slice, nx: int, ny: int) ndarray[tuple[Any, ...], dtype[int64]][source]#
Convert a 2D grid span to flattened node numbers.
The input
spanis applied to a temporary boolean-like array with shape(nx, ny). All selected cells are converted from 2D grid indices(ix, iy)to flattened regular-grid node numbers usingrlg_idx_to_nn().- Parameters:
span (Union[NDArrayInt, Tuple[slice, slice], slice]) – NumPy-style selection applied to a 2D array of shape
(nx, ny). Examples includeslice(None),(slice(0, 2), slice(None)), or an integer index array compatible with NumPy indexing.nx (int) – Number of grid cells along the x-axis.
ny (int) – Number of grid cells along the y-axis.
- Returns:
One-dimensional array of flattened node numbers corresponding to the selected cells. The returned array has dtype
np.int32.- Return type:
NDArrayInt
Notes
The grid follows the internal
(x, y)array convention, meaning that the temporary selection array has shape(nx, ny)rather than the image-style convention(ny, nx).The flattened numbering convention is:
node_number = ix + iy * nxThis function operates on grid cells, not on grid vertices.