------------------------------------------------------------------------------
| 382 | |
| 383 | //------------------------------------------------------------------------------ |
| 384 | int vtkHyperTreeGridRedistribute::ProcessTrees(vtkHyperTreeGrid* input, vtkDataObject* outputDO) |
| 385 | { |
| 386 | this->OutputHTG = vtkHyperTreeGrid::SafeDownCast(outputDO); |
| 387 | if (!this->OutputHTG) |
| 388 | { |
| 389 | vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName()); |
| 390 | return 0; |
| 391 | } |
| 392 | |
| 393 | if (!this->ExchangeHTGMetadata()) |
| 394 | { |
| 395 | return 0; |
| 396 | } |
| 397 | |
| 398 | if (input->HasMask()) |
| 399 | { |
| 400 | this->OutMask = vtk::TakeSmartPointer(vtkBitArray::New()); |
| 401 | } |
| 402 | |
| 403 | vtkDebugMacro("Collecting local tree indices"); |
| 404 | this->CollectLocalTreeIds(); |
| 405 | this->UpdateProgress(0.2); |
| 406 | |
| 407 | // Compute tree id <=> target partition id map |
| 408 | vtkDebugMacro("Build target partition map"); |
| 409 | this->TreeTargetPartId.resize(this->OutputHTG->GetMaxNumberOfTrees()); |
| 410 | this->BuildTargetPartMap(); |
| 411 | this->UpdateProgress(0.4); |
| 412 | |
| 413 | vtkDebugMacro("Exchanging HTG meta-data"); |
| 414 | vtkNew<vtkBitArray> descriptorSendBuffer; |
| 415 | std::vector<int> descriptorSizesReceivedBuffer; |
| 416 | std::vector<int> treeSizesSendBuffer; |
| 417 | std::vector<int> maskSizesSendBuffer; |
| 418 | std::vector<int> treeSizesReceivedBuffer; |
| 419 | std::vector<int> maskSizesReceivedBuffer; |
| 420 | std::vector<int> descriptorsByteOffsets; |
| 421 | this->ExchangeHyperTreeMetaData(descriptorSendBuffer, descriptorSizesReceivedBuffer, |
| 422 | treeSizesSendBuffer, maskSizesSendBuffer, treeSizesReceivedBuffer, maskSizesReceivedBuffer, |
| 423 | descriptorsByteOffsets); |
| 424 | |
| 425 | vtkDebugMacro("Building output trees"); |
| 426 | this->BuildOutputTrees( |
| 427 | descriptorSendBuffer, descriptorSizesReceivedBuffer, descriptorsByteOffsets); |
| 428 | this->OutputHTG->InitializeLocalIndexNode(); |
| 429 | this->UpdateProgress(0.6); |
| 430 | |
| 431 | if (this->HasMask) |
| 432 | { |
| 433 | vtkDebugMacro("Exchange mask information"); |
| 434 | this->ExchangeMask(maskSizesSendBuffer, maskSizesReceivedBuffer); |
| 435 | } |
| 436 | this->UpdateProgress(0.8); |
| 437 | |
| 438 | vtkDebugMacro("Exchange cell data"); |
| 439 | std::vector<int> cellsSentPerPartOffset(this->NumPartitions, 0); |
| 440 | std::vector<int> cellsReceivedPerPartOffset(this->NumPartitions, 0); |
| 441 | std::vector<int> nbCellDataSentPerPart(this->NumPartitions, 0); |
no test coverage detected