pytuflow.ADCF.reset#
- ADCF.reset(include_children=True)#
Resets all recorded changes made to the control file since the last call to
write()
. Recorded changes are automatically stored when inputs are changed, added, or removed from the control file. Thedirty
attribute can be checked to see if any changes have been made to the control file since the last call towrite()
.Note, the returned list of inputs are stored as
AlteredInput
, which is different from the input class used to store the inputs in the control file.- Parameters:
include_children (bool) – Only applicable for the TCF class. If set to
True
, will reset changes regardless of whether they were made in the current control file or a child. If set toFalse
, will only reset the changes in the current control file.- Returns:
A list of inputs that were reset by the reset operation. If no changes were made, an empty list is returned.
- Return type:
list[AlteredInput]
Examples
1! Control File 2Solution Scheme == HPC 3Hardware == GPU 4SGS == On
The following code comments out the SGS input and sets the hardware command to
CPU
. It then uses thereset
method to revert all the changes:>>> cf = ... # assume this is the loaded control file object >>> sgs_inp = cf.find_input('SGS == On')[0] >>> cf.comment_out(sgs_inp) <CommentInput> ! SGS == On >>> hardware_inp = cf.find_input('Hardware == GPU')[0] >>> hardware_inp.rhs = 'CPU'
Preview the content of the control file to confirm that the SGS input has been commented out and the hardware input has been changed to
CPU
:>>> cf.preview() ! Control File Solution Scheme == HPC Hardware == CPU ! SGS == On
Reset all operations to take the control file back to its original state:
>>> cf.reset() [<AlteredInput update_value> Hardware == GPU, <AlteredInput comment_out> ! SGS == On] >>> cf.preview() ! Control File Solution Scheme == HPC Hardware == GPU SGS == On