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

Method AddSubtree

Common/DataModel/vtkDataAssembly.cxx:526–564  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

524
525//------------------------------------------------------------------------------
526int vtkDataAssembly::AddSubtree(int parent, vtkDataAssembly* other, int otherParent)
527{
528 if (!other)
529 {
530 vtkErrorMacro("'other' cannot be nullptr.");
531 return -1;
532 }
533
534 auto& internals = (*this->Internals);
535 auto node = internals.FindNode(parent);
536 if (!node)
537 {
538 vtkErrorMacro("Parent node with id=" << parent << " not found.");
539 return -1;
540 }
541
542 auto& ointernals = (*other->Internals);
543 auto onode = ointernals.FindNode(otherParent);
544 if (!onode)
545 {
546 vtkErrorMacro("Note node with id=" << parent << " not found on 'other'");
547 return -1;
548 }
549
550 auto subtree = node.append_copy(onode);
551 if (otherParent == 0)
552 {
553 // remove type and version attributes.
554 subtree.remove_attribute(subtree.attribute("type"));
555 subtree.remove_attribute(subtree.attribute("version"));
556 }
557
558 // now update node ids on the copied subtree.
559 OffsetIdWalker walker(internals.MaxUniqueId + 1, internals.MaxUniqueDataSetId + 1);
560 subtree.traverse(walker);
561
562 // reset internal datastructure (and also validate it)
563 return internals.ParseDocument(this);
564}
565
566//------------------------------------------------------------------------------
567int vtkDataAssembly::AddNode(const char* name, int parent)

Callers 2

AddTimeStepMethod · 0.80
ProcessPDCMethod · 0.80

Calls 6

FindNodeMethod · 0.80
append_copyMethod · 0.80
remove_attributeMethod · 0.80
attributeMethod · 0.80
ParseDocumentMethod · 0.80
traverseMethod · 0.45

Tested by

no test coverage detected