------------------------------------------------------------------------------
| 4258 | |
| 4259 | //------------------------------------------------------------------------------ |
| 4260 | vtkUnstructuredGrid* vtkPDistributedDataFilter::MergeGrids(vtkDataSet** sets, int nsets, |
| 4261 | int deleteDataSets, int useGlobalNodeIds, float pointMergeTolerance, int useGlobalCellIds) |
| 4262 | { |
| 4263 | int i; |
| 4264 | |
| 4265 | if (nsets == 0) |
| 4266 | { |
| 4267 | return nullptr; |
| 4268 | } |
| 4269 | |
| 4270 | vtkUnstructuredGrid* newGrid = vtkUnstructuredGrid::New(); |
| 4271 | // Any global ids should be consistent, so make sure they are passed. |
| 4272 | newGrid->GetPointData()->CopyGlobalIdsOn(); |
| 4273 | newGrid->GetCellData()->CopyGlobalIdsOn(); |
| 4274 | |
| 4275 | vtkMergeCells* mc = vtkMergeCells::New(); |
| 4276 | mc->SetUnstructuredGrid(newGrid); |
| 4277 | |
| 4278 | mc->SetTotalNumberOfDataSets(nsets); |
| 4279 | |
| 4280 | vtkIdType totalPoints = 0; |
| 4281 | vtkIdType totalCells = 0; |
| 4282 | |
| 4283 | for (i = 0; i < nsets; i++) |
| 4284 | { |
| 4285 | totalPoints += sets[i]->GetNumberOfPoints(); |
| 4286 | totalCells += sets[i]->GetNumberOfCells(); |
| 4287 | // Only use global ids if they are available. |
| 4288 | useGlobalNodeIds = (useGlobalNodeIds && (sets[i]->GetPointData()->GetGlobalIds() != nullptr)); |
| 4289 | useGlobalCellIds = (useGlobalCellIds && (sets[i]->GetCellData()->GetGlobalIds() != nullptr)); |
| 4290 | } |
| 4291 | |
| 4292 | mc->SetTotalNumberOfPoints(totalPoints); |
| 4293 | mc->SetTotalNumberOfCells(totalCells); |
| 4294 | |
| 4295 | if (!useGlobalNodeIds) |
| 4296 | { |
| 4297 | mc->SetPointMergeTolerance(pointMergeTolerance); |
| 4298 | } |
| 4299 | mc->SetUseGlobalIds(useGlobalNodeIds); |
| 4300 | mc->SetUseGlobalCellIds(useGlobalCellIds); |
| 4301 | |
| 4302 | for (i = 0; i < nsets; i++) |
| 4303 | { |
| 4304 | mc->MergeDataSet(sets[i]); |
| 4305 | |
| 4306 | if (deleteDataSets) |
| 4307 | { |
| 4308 | sets[i]->Delete(); |
| 4309 | } |
| 4310 | } |
| 4311 | |
| 4312 | mc->Finish(); |
| 4313 | mc->Delete(); |
| 4314 | |
| 4315 | return newGrid; |
| 4316 | } |
| 4317 |
nothing calls this directly
no test coverage detected