Obtaining the CellData of a given Cell

Consider the code below:

reader = PVDReader(FileName="./function.pvd")
data = servermanager.Fetch(reader)
cells = data.GetCells()

cell_data_arr = data.GetCellData().GetArray(0)
for i in range(cells.GetNumberOfCells()):
    my_cell = data.GetCell(i)
    radius = cell_data_arr.GetTuple1(i)

This seems to work, and I am getting the value corresponding to cell “my_cell”, but I don’t see anywhere something that guarantees that the way cell_data_arr is ordered coincides with the cell numbering. Are there other ways to obtain the CellData corresponding to the cell “my_cell”?

You have it right. In your code, i is a canonical cell id and is guaranteed to index the same cell from both the dataset and the cell data. Cells are identified by their 0-based index.