I am using VTK in Python. I am using a DataObjectTreeIterator to traverse a MultiBlockDataSet by calling NewTreeIterator(). It appears to be working as expected, but I have two questions about improving performance:
The documentation here for NewTreeIterator()
https://vtk.org/doc/nightly/html/classvtkDataObjectTree.html#ae63004164efaca28b7ec2b87123f6c85 states that the iterator must be deleted by the user. I have seen no examples where this deletion is performed, nor do I see a method to do so. Do I need to add something to effect this deletion?
I am using the iterator to look up data corresponding to a particular identifier. Once the identifier has been located, I can get the data, and I no longer need the iterator. Is there a way to break out of the iterator early (similar to using a “break” clause in a Python loop)? Assuming that there is, is breaking out of the iterator going to lead to any appreciable memory or time savings?