MCPcopy Create free account
hub / github.com/Kitware/VTK / ProcessTrees

Method ProcessTrees

Filters/HyperTree/vtkHyperTreeGridContour.cxx:531–696  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

529
530//------------------------------------------------------------------------------
531int 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();

Callers

nothing calls this directly

Calls 15

GetNumberOfContoursMethod · 0.95
CreateDefaultLocatorMethod · 0.95
ReplaceWithIndexedArrayFunction · 0.85
HasMaskMethod · 0.80
GetGhostCellsMethod · 0.80
GetNextTreeMethod · 0.80
CheckAbortMethod · 0.80

Tested by

no test coverage detected