------------------------------------------------------------------------------
| 273 | |
| 274 | //------------------------------------------------------------------------------ |
| 275 | int vtkHyperTreeGridGhostCellsGenerator::ProcessTrees( |
| 276 | vtkHyperTreeGrid* input, vtkDataObject* outputDO) |
| 277 | { |
| 278 | int numberOfProcesses = this->Controller->GetNumberOfProcesses(); |
| 279 | |
| 280 | vtkHyperTreeGrid* output = vtkHyperTreeGrid::SafeDownCast(outputDO); |
| 281 | if (!output) |
| 282 | { |
| 283 | vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName()); |
| 284 | return 0; |
| 285 | } |
| 286 | |
| 287 | if (input->HasAnyGhostCells()) |
| 288 | { |
| 289 | vtkWarningMacro("Ghost cells already computed, we reuse them."); |
| 290 | output->ShallowCopy(input); |
| 291 | return 1; |
| 292 | } |
| 293 | |
| 294 | vtkDebugMacro(<< "Start processing trees: copy input structure"); |
| 295 | output->Initialize(); |
| 296 | if (numberOfProcesses == 1) |
| 297 | { |
| 298 | // No ghost cells to generate if we have a single process, pass through |
| 299 | output->ShallowCopy(input); |
| 300 | return 1; |
| 301 | } |
| 302 | else |
| 303 | { |
| 304 | output->CopyEmptyStructure(input); |
| 305 | output->GetCellData()->CopyStructure(input->GetCellData()); |
| 306 | } |
| 307 | |
| 308 | vtkHyperTreeGridGhostCellsGeneratorInternals subroutines{ this, this->Controller, input, output }; |
| 309 | subroutines.InitializeCellData(); |
| 310 | this->UpdateProgress(0.1); |
| 311 | |
| 312 | // Create a vector containing the processId of each consecutive tree in the HTG. |
| 313 | vtkDebugMacro("Broadcast tree locations"); |
| 314 | subroutines.BroadcastTreeLocations(); |
| 315 | this->UpdateProgress(0.2); |
| 316 | |
| 317 | vtkDebugMacro("Determine neighbors"); |
| 318 | subroutines.DetermineNeighbors(); |
| 319 | this->UpdateProgress(0.3); |
| 320 | |
| 321 | vtkDebugMacro("Exchange sizes with neighbors"); |
| 322 | if (subroutines.ExchangeSizes() == 0) |
| 323 | { |
| 324 | vtkErrorMacro("Failure during size exchange, aborting."); |
| 325 | return 0; |
| 326 | } |
| 327 | this->Controller->Barrier(); |
| 328 | this->UpdateProgress(0.4); |
| 329 | |
| 330 | vtkDebugMacro("Exchange tree decomposition and masks with neighbors"); |
| 331 | if (subroutines.ExchangeTreeDecomposition() == 0) |
| 332 | { |
no test coverage detected