Updating UnstructredGrid after Adding Cell

Current System (bottom-up):

  • points (vtkSmartPointer< vtkPoints >)
  • topology(vtkSmartPointer< vtkCellArray >)
  • unGrid(vtkSmartPointer< vtkUnstructuredGrid >)
  • mapper(vtkSmartPointer< vtkDataSetMapper >)
  • actor(vtkSmartPointer< vtkActor >)

My Attempt to Add New Cell and Update:
I have added a new cell to topology and am confused on how to update this system. It consists of existing points, so have tried:

topology->InsertNextCell(newCell);
unGrid->GetCells()->Modified();

Questions:

  • What thing(s) do I need to update(call Modifed() ) on, just unGrid?
  • Since I need to specify the cell types when I SetCells() for unGrid, do I need to do this again when I add a new cell(since it could be of a new type)?

Notes:

  • vtk 8.2.0
  • Must use unstructured grid

I thought this would be a pretty fundamental question, so I’ll just come back with updates if I make any more progress.

Very simple solution, after trying many things I simply replaced:

unGrid->GetCells()->Modified();

With:
unGrid->Modified();

1 Like