pyvista.Cell.copy#

Cell.copy(deep=True) Cell[source]#

Return a copy of the cell.

Parameters:
deepbool, optional

When True makes a full copy of the cell. When False, performs a shallow copy where the new cell still references the original cell.

Returns:
pyvista.Cell

Deep or shallow copy of the cell.

Examples

Create a deep copy of the cell and demonstrate it is deep.

>>> from pyvista.examples.cells import Tetrahedron
>>> mesh = Tetrahedron()
>>> cell = mesh.get_cell(0)
>>> deep_cell = cell.copy(deep=True)
>>> deep_cell.points[:] = 0
>>> cell != deep_cell
True

Create a shallow copy of the cell and demonstrate it is shallow.

>>> shallow_cell = cell.copy(deep=False)
>>> shallow_cell.points[:] = 0
>>> cell == shallow_cell
True