Cell.copy#
- Cell.copy(deep: bool = True) Self[source]#
Return a copy of the cell.
- Parameters:
- deepbool,
optional When
Truemakes a full copy of the cell. WhenFalse, performs a shallow copy where the new cell still references the original cell.
- deepbool,
- Returns:
pyvista.CellDeep or shallow copy of the cell.
Examples#
Download Python source code | Download Jupyter notebook
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