------------------------------------------------------------------------------
| 697 | |
| 698 | //------------------------------------------------------------------------------ |
| 699 | bool vtkHyperTreeGridContour::RecursivelyPreProcessTree(vtkHyperTreeGridNonOrientedCursor* cursor) |
| 700 | { |
| 701 | // Retrieve global index of input cursor |
| 702 | vtkIdType id = cursor->GetGlobalNodeIndex(); |
| 703 | |
| 704 | if (this->InGhostArray && this->InGhostArray->GetTuple1(id)) |
| 705 | { |
| 706 | return false; |
| 707 | } |
| 708 | |
| 709 | // Retrieve number of contours |
| 710 | vtkIdType numContours = this->ContourValues->GetNumberOfContours(); |
| 711 | |
| 712 | // Descend further into input trees only if cursor is not a leaf |
| 713 | bool selected = false; |
| 714 | if (!cursor->IsLeaf() && !cursor->IsMasked()) |
| 715 | { |
| 716 | // Cursor is not at leaf, recurse to all all children |
| 717 | int numChildren = cursor->GetNumberOfChildren(); |
| 718 | std::vector<bool> signs(numContours); |
| 719 | for (int child = 0; child < numChildren; ++child) |
| 720 | { |
| 721 | if (this->CheckAbort()) |
| 722 | { |
| 723 | break; |
| 724 | } |
| 725 | // Create storage for signs relative to contour values |
| 726 | |
| 727 | cursor->ToChild(child); |
| 728 | |
| 729 | // Recurse and keep track of whether this branch is selected |
| 730 | selected |= this->RecursivelyPreProcessTree(cursor); |
| 731 | |
| 732 | // Check if branch not completely selected |
| 733 | if (!selected) |
| 734 | { |
| 735 | // If not, update contour values |
| 736 | for (int c = 0; c < numContours; ++c) |
| 737 | { |
| 738 | // Retrieve global index of child |
| 739 | vtkIdType childId = cursor->GetGlobalNodeIndex(); |
| 740 | |
| 741 | // Compute and store selection flags for current contour |
| 742 | if (child == 0) |
| 743 | { |
| 744 | // Initialize sign array with sign of first child |
| 745 | signs[c] = (this->CellSigns[c]->GetTuple1(childId) != 0.0); |
| 746 | } |
| 747 | else |
| 748 | { |
| 749 | // For subsequent children compare their sign with stored value |
| 750 | if (signs[c] != (this->CellSigns[c]->GetTuple1(childId) != 0.0)) |
| 751 | { |
| 752 | // A change of sign occurred, therefore cell must selected |
| 753 | selected = true; |
| 754 | } |
| 755 | } // else |
| 756 | } // c |
no test coverage detected