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

Method RecursivelyProcessTree

Filters/HyperTree/vtkHyperTreeGridThreshold.cxx:395–471  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

393
394//------------------------------------------------------------------------------
395bool vtkHyperTreeGridThreshold::RecursivelyProcessTree(
396 vtkHyperTreeGridNonOrientedCursor* inCursor, vtkHyperTreeGridNonOrientedCursor* outCursor)
397{
398 // Retrieve global index of input cursor
399 vtkIdType inId = inCursor->GetGlobalNodeIndex();
400
401 // Increase index count on output: postfix is intended
402 vtkIdType outId = this->CurrentId++;
403
404 // Copy out cell data from that of input cell
405 if (!this->Internal->CDManager)
406 {
407 vtkErrorMacro("Must set the CellDataManager before processing trees");
408 return false;
409 }
410 (*(this->Internal->CDManager))(inId, outId);
411
412 // Retrieve output tree and set global index of output cursor
413 vtkHyperTree* outTree = outCursor->GetTree();
414 outTree->SetGlobalIndexFromLocal(outCursor->GetVertexId(), outId);
415
416 // Flag to recursively decide whether a tree node should discarded
417 bool discard = true;
418
419 if (this->InMask && this->InMask->GetValue(inId))
420 {
421 // Mask output cell if necessary
422 this->OutMask->InsertTuple1(outId, discard);
423
424 // Return whether current node is within range
425 return discard;
426 }
427
428 // Descend further into input trees only if cursor is not at leaf
429 if (!inCursor->IsLeaf())
430 {
431 // Cursor is not at leaf, subdivide output tree one level further
432 outCursor->SubdivideLeaf();
433
434 // If input cursor is neither at leaf nor at maximum depth, recurse to all children
435 int numChildren = inCursor->GetNumberOfChildren();
436 for (int ichild = 0; ichild < numChildren; ++ichild)
437 {
438 if (this->CheckAbort())
439 {
440 break;
441 }
442 // Descend into child in input grid as well
443 inCursor->ToChild(ichild);
444 // Descend into child in output grid as well
445 outCursor->ToChild(ichild);
446 // Recurse and keep track of whether some children are kept
447 discard &= this->RecursivelyProcessTree(inCursor, outCursor);
448 // Return to parent in input grid
449 outCursor->ToParent();
450 // Return to parent in output grid
451 inCursor->ToParent();
452 } // child

Callers 1

ProcessTreesMethod · 0.95

Calls 13

InsertTuple1Method · 0.80
CheckAbortMethod · 0.80
GetTuple1Method · 0.80
GetGlobalNodeIndexMethod · 0.45
GetTreeMethod · 0.45
GetVertexIdMethod · 0.45
GetValueMethod · 0.45
IsLeafMethod · 0.45
SubdivideLeafMethod · 0.45
GetNumberOfChildrenMethod · 0.45
ToChildMethod · 0.45

Tested by

no test coverage detected