Renumbering mesh cells

Hi everyone,

I’m interested in exchanging the local index of some cells in a vtkUnstructuredGrid object. Does anyone know if there is a function in VTK which allows to modify or exchange the indices of two cells?

Thank you for your help!

Can you describe what effect you’re trying to obtain? Because it doesn’t make much sense to change the index of a cell. The index is the address of a cell. Are you trying to swap properties or geometry? Or both?

Renumbering the indices of the cells in a mesh might be interesting because it allows to improve the performance of some linear algebra algorithms whose performance is dependant on the contiguity of the data of the cell neighbors.

I have seen that there is a function called ReplaceLinkedCell and ReplaceCellAtId which might allow to do this process of renumbering mesh cells. However, it seems that these methods don’t work if the exchanged cells have different number of nodes. Could anyone confirm me if this is the case please?