MultiBlock.n_cells

Contents

MultiBlock.n_cells#

property MultiBlock.n_cells: int[source]#

Return the total number of cells in all blocks.

Nested blocks are counted recursively and None blocks count as zero.

Added in version 0.50.

Examples#

Download Python source code | Download Jupyter notebook

>>> import pyvista as pv
>>> multi = pv.MultiBlock([pv.Sphere(), pv.MultiBlock([pv.Cube()]), None])
>>> multi.n_cells
1686

This is the sum over all leaf datasets.

>>> sum(block.n_cells for block in multi.recursive_iterator(skip_none=True))
1686