------------------------------------------------------------------------------
| 529 | |
| 530 | //------------------------------------------------------------------------------ |
| 531 | int vtkHyperTreeGridContour::ProcessTrees(vtkHyperTreeGrid* input, vtkDataObject* outputDO) |
| 532 | { |
| 533 | // Downcast output data object to polygonal data set |
| 534 | vtkPolyData* output = vtkPolyData::SafeDownCast(outputDO); |
| 535 | if (!output) |
| 536 | { |
| 537 | vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName()); |
| 538 | return 0; |
| 539 | } |
| 540 | |
| 541 | // Retrieve scalar quantity of interest |
| 542 | this->InScalars = this->GetInputArrayToProcess(0, input); |
| 543 | if (!this->InScalars) |
| 544 | { |
| 545 | vtkWarningMacro(<< "No scalar data to contour"); |
| 546 | return 1; |
| 547 | } |
| 548 | |
| 549 | // Initialize output point data |
| 550 | this->InData = input->GetCellData(); |
| 551 | this->OutData = output->GetPointData(); |
| 552 | this->OutData->CopyAllocate(this->InData); |
| 553 | |
| 554 | // Output indices begin at 0 |
| 555 | this->CurrentId = 0; |
| 556 | |
| 557 | // Retrieve material mask |
| 558 | this->InMask = input->HasMask() ? input->GetMask() : nullptr; |
| 559 | |
| 560 | // Retrieve ghost cells |
| 561 | this->InGhostArray = input->GetGhostCells(); |
| 562 | |
| 563 | // Estimate output size as a multiple of 1024 |
| 564 | vtkIdType numCells = input->GetNumberOfCells(); |
| 565 | vtkIdType numContours = this->ContourValues->GetNumberOfContours(); |
| 566 | vtkIdType estimatedSize = static_cast<vtkIdType>(pow(static_cast<double>(numCells), .75)); |
| 567 | estimatedSize *= numContours; |
| 568 | estimatedSize = estimatedSize / 1024 * 1024; |
| 569 | estimatedSize = std::max<vtkIdType>(estimatedSize, 1024); |
| 570 | |
| 571 | // Create storage for output points |
| 572 | vtkPoints* newPts = vtkPoints::New(); |
| 573 | newPts->Allocate(estimatedSize, estimatedSize); |
| 574 | |
| 575 | // Create storage for output vertices |
| 576 | vtkNew<vtkCellArray> newVerts; |
| 577 | newVerts->AllocateExact(estimatedSize, estimatedSize); |
| 578 | |
| 579 | // Create storage for output lines |
| 580 | vtkNew<vtkCellArray> newLines; |
| 581 | newLines->AllocateExact(estimatedSize, estimatedSize); |
| 582 | |
| 583 | // Create storage for output polygons |
| 584 | vtkNew<vtkCellArray> newPolys; |
| 585 | newPolys->AllocateExact(estimatedSize, estimatedSize); |
| 586 | |
| 587 | // Create storage for output scalar values |
| 588 | this->CellScalars = this->InScalars->NewInstance(); |
nothing calls this directly
no test coverage detected