ogstools.meshlib.vtk_pyvista module#

ogstools.meshlib.vtk_pyvista.cell_points(cell_type)[source]#

Return the number of points for a given VTK fixed-size cell type.

Parameters#

cell_typeint

VTK cell type ID (e.g., vtk.VTK_LINE, vtk.VTK_TRIANGLE, etc.)

Returns#

int

Number of points for this cell type.

Raises#

AttributeError

If the cell type is variable-sized (e.g., POLY_LINE, POLYGON), since their number of points is not fixed.

Example#

>>> import vtk
>>> cell_points(vtk.VTK_LINE)
2
>>> cell_points(vtk.VTK_TRIANGLE)
3
Return type:

int

ogstools.meshlib.vtk_pyvista.construct_cells(connectivity, cell_types)[source]#

Construct a VTK cells array from connectivity + cell types. Only supports fixed-size cell types.

Parameters#

connectivity : Concatenated point indices for all cells. VTK convention. cell_types : VTK cell types (same length as number of cells).

Returns#

cells : Flattened VTK-style cell array [npts, id0, id1, …]. Pyvista convention

Return type:

array