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

Function BuildDescriptor

IO/XML/vtkXMLHyperTreeGridWriter.cxx:383–417  ·  view source on GitHub ↗

Depth first recursion to walk the tree in child order Used to create the breadth first BitArray descriptor appending node and leaf indicator by level

Source from the content-addressed store, hash-verified

381// node and leaf indicator by level
382//
383void BuildDescriptor(vtkHyperTreeGridNonOrientedCursor* inCursor, int level, bool hasMask,
384 unsigned int numChildren, std::vector<std::string>& descriptor, std::vector<std::string>& mask)
385{
386 // Append to mask string
387 if (hasMask)
388 {
389 if (inCursor->IsMasked())
390 mask[level] += '1';
391 else
392 mask[level] += '0';
393 }
394
395 // Append to descriptor string
396 if (!inCursor->IsLeaf())
397 {
398 descriptor[level] += 'R';
399
400 // If input cursor is not a leaf, recurse to all children
401 for (unsigned int child = 0; child < numChildren; ++child)
402 {
403 // Move cursor to child
404 inCursor->ToChild(child);
405
406 // Recurse
407 BuildDescriptor(inCursor, level + 1, hasMask, numChildren, descriptor, mask);
408
409 // Move cursor back to parent
410 inCursor->ToParent();
411 } // child
412 }
413 else
414 {
415 descriptor[level] += '.';
416 }
417}
418}
419
420//------------------------------------------------------------------------------

Callers 1

WriteTrees_0Method · 0.85

Calls 4

IsMaskedMethod · 0.45
IsLeafMethod · 0.45
ToChildMethod · 0.45
ToParentMethod · 0.45

Tested by

no test coverage detected