cherab.imas.math.tetrahedralize.cell_to_6tetraΒΆ

cherab.imas.math.tetrahedralize.cell_to_6tetra(cells)ΒΆ

Generate tetrahedral indices by dividing one cell into 6 tetrahedra.

One cubic-like cell having 8 vertices can be divided into six tetrahedra. This manner is useful when the cell is twisted.

Parameters:
cells : (N,8) ndarray [numpy.int32]ΒΆ

Cell indices 2D array, the shape of which is \((N, 8)\), where \(N\) is the number of cells.

Returns:

Tetrahedra indices array, the shape of which is \((6N, 4)\).

Return type:

(6N,4) ndarray

Examples

>>> import numpy as np
>>> from cherab.imas.math.tetrahedralize import cell_to_6tetra
>>>
>>> array = np.arrange(16, dtype=np.int32).reshape((2, -1))
>>> array
array([[ 0,  1,  2,  3,  4,  5,  6,  7],
       [ 8,  9, 10, 11, 12, 13, 14, 15]], dtype=int32)
>>> cell_to_6tetra(array)
array([[ 6,  2,  1,  0],
       [ 7,  3,  2,  0],
       [ 0,  7,  6,  2],
       [ 1,  5,  6,  4],
       [ 0,  4,  6,  7],
       [ 6,  4,  0,  1],
       [14, 10,  9,  8],
       [15, 11, 10,  8],
       [ 8, 15, 14, 10],
       [ 9, 13, 14, 12],
       [ 8, 12, 14, 15],
       [14, 12,  8,  9]], dtype=int32)