# Updating UnstructredGrid after Adding Cell

**URL:** https://discourse.vtk.org/t/updating-unstructredgrid-after-adding-cell/2345
**Category:** Development
**Created:** [December 27, 2019, 10:15am UTC](https://discourse.vtk.org/t/updating-unstructredgrid-after-adding-cell/2345 "2019-12-27T10:15:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ChristopherWaters](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/d78d45/32.png) [@ChristopherWaters](https://discourse.vtk.org/u/ChristopherWaters)
#### Post date: [December 27, 2019, 10:15am UTC](https://discourse.vtk.org/t/updating-unstructredgrid-after-adding-cell/2345/1 "2019-12-27T10:15:41Z")

</div>

**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:

```auto
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

---

<div class="post-metadata">

### Author: ![ChristopherWaters](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/d78d45/32.png) [@ChristopherWaters](https://discourse.vtk.org/u/ChristopherWaters)
#### Post date: [December 29, 2019, 9:02am UTC](https://discourse.vtk.org/t/updating-unstructredgrid-after-adding-cell/2345/2 "2019-12-29T09:02:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ChristopherWaters](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/d78d45/32.png) [@ChristopherWaters](https://discourse.vtk.org/u/ChristopherWaters)
#### Post date: [December 29, 2019, 9:43am UTC](https://discourse.vtk.org/t/updating-unstructredgrid-after-adding-cell/2345/3 "2019-12-29T09:43:53Z")

</div>

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

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

```

**With:**  
`unGrid->Modified();`
