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

Method RecursivelyPreProcessTree

Filters/HyperTree/vtkHyperTreeGridPlaneCutter.cxx:513–570  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

511
512//------------------------------------------------------------------------------
513bool vtkHyperTreeGridPlaneCutter::RecursivelyPreProcessTree(
514 vtkHyperTreeGridNonOrientedGeometryCursor* cursor)
515{
516 // If cursor is at a masked cell stop recursion
517 vtkIdType id = cursor->GetGlobalNodeIndex();
518 if (this->InMask && this->InMask->GetValue(id))
519 {
520 return false;
521 }
522
523 // A node is not selected until proven otherwise
524 bool selected = false;
525
526 // Retrieve cursor geometry
527 double* origin = cursor->GetOrigin();
528 double* size = cursor->GetSize();
529
530 // Initialize cell coordinates
531 double cellCoords[8][3];
532 for (int i = 0; i < 8; ++i)
533 {
534 cellCoords[i][0] = (i & 1) ? origin[0] + size[0] : origin[0];
535 cellCoords[i][1] = (i & 2) ? origin[1] + size[1] : origin[1];
536 cellCoords[i][2] = (i & 4) ? origin[2] + size[2] : origin[2];
537 }
538
539 // Check cell-plane intersection
540 if (this->CheckIntersection(cellCoords))
541 {
542 // Selected this node
543 if (cursor->IsLeaf())
544 {
545 selected = true;
546 } // if ( cursor->IsLeaf() )
547 else
548 {
549 // Cursor is not at leaf, recurse to all children
550 int numChildren = cursor->GetNumberOfChildren();
551 for (int ichild = 0; ichild < numChildren; ++ichild)
552 {
553 if (this->CheckAbort())
554 {
555 break;
556 }
557 cursor->ToChild(ichild);
558 // Recurse and keep track of whether this branch is selected
559 selected |= this->RecursivelyPreProcessTree(cursor);
560 cursor->ToParent();
561 } // ichild
562 } // else
563 } // if ( this->CheckIntersection )
564
565 // Update list of selected cells
566 this->SelectedCells->SetTuple1(id, selected);
567
568 // Return whether current node was selected
569 return selected;
570}

Callers 1

ProcessTreesMethod · 0.95

Calls 11

CheckIntersectionMethod · 0.95
CheckAbortMethod · 0.80
SetTuple1Method · 0.80
GetGlobalNodeIndexMethod · 0.45
GetValueMethod · 0.45
GetOriginMethod · 0.45
GetSizeMethod · 0.45
IsLeafMethod · 0.45
GetNumberOfChildrenMethod · 0.45
ToChildMethod · 0.45
ToParentMethod · 0.45

Tested by

no test coverage detected