------------------------------------------------------------------------------
| 597 | |
| 598 | //------------------------------------------------------------------------------ |
| 599 | int vtkHyperTreeGridSource::ProcessTrees(vtkHyperTreeGrid*, vtkDataObject* outputDO) |
| 600 | { |
| 601 | // Downcast output data object to hyper tree grid |
| 602 | vtkHyperTreeGrid* output = vtkHyperTreeGrid::SafeDownCast(outputDO); |
| 603 | if (!output) |
| 604 | { |
| 605 | vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName()); |
| 606 | return 0; |
| 607 | } |
| 608 | |
| 609 | // Reset process counter |
| 610 | this->CurrentTreeProcess = 0; |
| 611 | |
| 612 | // Iterate over all hyper trees |
| 613 | vtkIdType nbTrees; |
| 614 | if (this->LevelZeroMaterialIndex) |
| 615 | { |
| 616 | nbTrees = this->LevelZeroMaterialIndex->GetNumberOfValues(); |
| 617 | } |
| 618 | else |
| 619 | { |
| 620 | nbTrees = output->GetMaxNumberOfTrees(); |
| 621 | } |
| 622 | vtkNew<vtkHyperTreeGridNonOrientedCursor> cursor; |
| 623 | vtkIdType offset = 0; |
| 624 | for (vtkIdType itree = 0; itree < nbTrees; ++itree) |
| 625 | { |
| 626 | vtkIdType index = itree; |
| 627 | |
| 628 | if (this->LevelZeroMaterialIndex) |
| 629 | { |
| 630 | index = this->LevelZeroMaterialIndex->GetTuple1(itree); |
| 631 | } |
| 632 | |
| 633 | unsigned int i, j, k; |
| 634 | output->GetLevelZeroCoordinatesFromIndex(index, i, j, k); |
| 635 | |
| 636 | // Initialize cursor |
| 637 | output->InitializeNonOrientedCursor(cursor, index, true); |
| 638 | |
| 639 | // Initialize local cell index |
| 640 | int idx[3] = { 0, 0, 0 }; |
| 641 | |
| 642 | if (this->UseDescriptor) |
| 643 | { |
| 644 | if (!this->DescriptorBits) |
| 645 | { |
| 646 | char currentChar = this->LevelDescriptors[0][index + offset]; |
| 647 | if (currentChar != 'R' && currentChar != '.') |
| 648 | { |
| 649 | this->CurrentTreeProcess = currentChar - '0'; |
| 650 | offset++; |
| 651 | if (this->CurrentTreeProcess < 0 || this->CurrentTreeProcess > 9) |
| 652 | { |
| 653 | vtkErrorMacro("Unexpected level " << CurrentTreeProcess); |
| 654 | return 0; |
| 655 | } |
| 656 | } |
no test coverage detected