test: Generator node re-runs #2284
Open
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.
This PR aims to combat the issue we ran into while working on the Dissolve2 atomShake unit test, namely, that the generator parts of the graph can run unnecessarily on subsequent runs where the source
ConfigurationNodeis modified (i.e. via the "Temperature" option).This aims to be one of two variants of this solution that I am exploring, so there may well be two PRs in the end.
Ultimately, to accomplish this we need to be able to notify the generator nodes (such as
InsertNode) that the changes to the state of source configuration necessitate or preclude their re-running.For example, in the schematic above, in panel A) the graph performs its first run, and all nodes run as usual. In B), we change the temperature of the configuration at its source, which precludes a second run of the generator. Finally, in C), we modify the species population in the generator itself, so everything runs once again.
This is achieved by a system of flagging that is set on the actual
Configurationinstance being pointed to. When an option/input is set in certain nodes, we can call an overloadedonValueSetmethod which can be used to set flags on a node's data member - in this case, theConfiguration::regenerateRequired_flag is set tofalsewhen the "Temperature" option is set. Conversely, when the "Population" or "Density" is changed, the flag istrue.This gives us a way to communicate this information between relevant nodes, but does not affect other configuration/generator sources that might exist in a more complex graph.
One limitation to the method demonstrated here, is that after modifying the node option the user must individually run the
ConfigurationNodebefore re-running the entire graph.