| 324 | } |
| 325 | |
| 326 | vtkCellMetadata* vtkCellGrid::AddCellMetadata(vtkCellMetadata* cellType) |
| 327 | { |
| 328 | if (!cellType) |
| 329 | { |
| 330 | return cellType; |
| 331 | } |
| 332 | auto it = this->Cells.find(cellType->Hash()); |
| 333 | if (it != this->Cells.end()) |
| 334 | { |
| 335 | // Do not take ownership of cellType; return the instance we own. |
| 336 | return it->second; |
| 337 | } |
| 338 | // OK, we don't already have this type... insert it. |
| 339 | vtkSmartPointer<vtkCellMetadata> owner = cellType; |
| 340 | this->Cells[owner->Hash()] = owner; |
| 341 | owner->SetCellGrid(this); |
| 342 | // Because we have added cells, clear any cell-attribute ranges cached. |
| 343 | this->RangeCache.clear(); |
| 344 | return cellType; |
| 345 | } |
| 346 | |
| 347 | vtkCellMetadata* vtkCellGrid::AddCellMetadata(vtkStringToken cellTypeName) |
| 348 | { |