Destroy only created vars on BeginStep and again on Reader close #3272
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extending prior PR to BP3/4...
Note: The test here checks to see if a variable created by reader BeginStep gets deleted in Reader::Close(). I'd like to test to make sure that non-created variables remain available, but that isn't really possible because for some engines, InqVar simply doesn't work under any circumstances for such variables. This is because of the interwoven nature of the logic and the need to return NULL for an otherwise valid variable if the IO is in "streaming read mode" and there is no valid data for that timestep. So for now, simply not testing that part as the tangle is too broken to fix.
However, this PR introduces Engine-class methods to RegisterCreatedVariable() and RemoveCreatedVars() so that reader engines can more easily clean up after themselves. I've modified BP3/4, and SST readers to take advantage of these. I'll leave the other engines up to their maintainers...